A simple tool for FASTA statistics

The issue

It is surprisingly difficult to compute simple statistics of FASTA files using existing software. I recently needed to compute the nucleotide count and relative GC frequency of a single sequence in FASTA format, but unless you install dependency-heavy native software like FASTX or you develop it by yourself using BioPython or similar, there doesn’t seem to be a simple, dependency-free solution for this simple set of problem.

Continue reading →

Posted by Uli Köhler in Bioinformatics, Python

Checking if Hugepages are enabled in Linux


On your Linux system, you want to check whether transparent hugepages are enabled on your system.


It’s pretty simple:

cat /sys/kernel/mm/transparent_hugepage/enabled

You will get an output like this:

always [madvise] never

You’ll see a list of all possible options ( always, madvise, never ), with the currently active option being enclosed in brackets.madvise is the default.

Continue reading →

Posted by Uli Köhler in Linux, Performance

User Mode Linux for Beginners – Setup and first VM

Why another UML tutorial?

This is not the first tutorial on UML — there are hundreds of them publicly available on the internet. However, none of them seems to fulfill my requirements:

  • All my computers and servers (= UML hosts) run on x86_64, not on i386.
  • Use an up-to date (self-compiled) UML version, so you can use the latest features
  • One simple set of scripts. Execute them in the correct order to get it up and running – no config file editing etc.
  • Root should not be required (disregarding debootstrap) —> No /mnt mounts or similar
  • No nasty filesystem image that eats up space on the host and limits resources on the UML VM. HostFS eliminates all those disadvantages – if you want to limit VM space, use quotas.
  • No global state (e.g. mounting sth into /mnt), you should get another VM up and running concurrently by executing the setup scripts in another directory.
  • Step-by-step instructions, as automated and portable as possible, but still made to be read by humans.
  • No expansive techtalk. There are reference documentations out there for techtalk. A tutorial should tell you how to get it working, not why it works.

Continue reading →

Posted by Uli Köhler in Container, Linux

Building LevelDB Debian (.deb) packages


You intend to install LevelDB, but you don’t want to manually install & compile it as described here.

Instead, you just want to use the debian packaging system and some reproducible method of creating a DEB package from LevelDB.

Reasons for preferring not to compile & install manually could be:

  • You want to deploy LevelDB to one ore more environments that don’t have a complete build environment
  • You prefer a clean install-uninstall-purge package lifetime management
  • You need a reproducible process to deploy LevelDB

Continue reading →

Posted by Uli Köhler in Allgemein

mmap with Boost IOStreams: A minimalist’s example

The following C++ program uses boost::iostreams to memory-map a file, read it’s content into a std::string and print it to cout.

It provides a minimal example of how to use the boost::iostreams portable mmap functionality.

//Compile like this: g++ -o mmap mmap.cpp -lboost_iostreams
#include <boost/iostreams/device/mapped_file.hpp>
#include <iostream>
#include <string>
using namespace std;
using namespace boost::iostreams;

int main(int argc, char** argv) {
   //Initialize the memory-mapped file
   mapped_file_source file(argv[1]);
   //Read the entire file into a string
   string fileContent(file.data(), file.size());
   //Print the string
   cout << fileContent;

Also see A simple mmap() readonly example

Posted by Uli Köhler in C/C++

Reading TAR files in C++

This article describes a method of  reading TAR archives (including .tar.gz and .tar.bz2) in C++ using Boost IOStreams.

You could use libtar for this, but the original version hasn’t been updated since 2003 and doesn’t provide you flexibility and insight to the internal structure of a TAR archive. Continue reading →

Posted by Uli Köhler in Algorithms, C/C++

ffmpeg / avconv : List supported codecs

You can list all codecs supported by libavconv (the library used by ffmpeg / avconv) by using this command:

ffmpeg -codecs

If you don’t have the ffmpeg executable simply use

avconv -codecs

Note that avconv and ffmpeg are essentially the same, but the projects split at some time and then re-merged. Starting from Ubuntu 15.04, ffmpeg is available in the repositories again, whereas previously, ffmpeg was replaced by avconv.

For details, see this StackOverflow thread and this detailed post about the ffmpeg/libav situation.

Posted by Uli Köhler in Allgemein

How to fix “Cannot find crt1.o” on Ubuntu


You’re trying to compile something (e.g. using GCC) on Ubuntu, but you get an error message similar to this one:

/usr/bin/ld: error: cannot open crt1.o: No such file or directory
/usr/bin/ld: error: cannot open crti.o: No such file or directory
/usr/bin/ld: error: cannot open crtn.o: No such file or directory

Continue reading →

Posted by Uli Köhler in Build systems, Linux
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPTPrivacy &amp; Cookies Policy