Author Archives: Thomas Cokelaer

Meaning of Real, User and Sys time statistics

Tweet Under Linux, the time command is quite convenient to get the elapsed time taken by a command call. It is very simple to use: just type your command preceded by the time command itself. For instance:

The output … Continue reading

Posted in Linux | 2 Comments

git : How to remove a big file wrongly committed

Tweet I added a large file to a git repository (102Mb), commited and push and got an error due to size limit limitations on github

Here, you see the path of the file (coverage/sensitivity/simualted.bed). So, the solution is actually … Continue reading

Posted in Computer Science | Tagged , | Leave a comment

git and github : skip password typing with https

Tweet If you clone a github repository using the https:// method (instead of ssh), you will have to type your username and passwor all the time. In order to avoid having to type you password all the time, you can … Continue reading

Posted in Computer Science | Tagged | Leave a comment

failed to convert from cram to bam (parse error CIGAR character)

Tweet In order to convert a bioinformatic file from CRAM to BAM format, I naively used the samtools command available on a cluster but got this error:

After a few commands trying to fix the issue, I realised that … Continue reading

Posted in bioinformatics | Tagged | Leave a comment

How to mount and create a partition on a hard drive dock (fedora)

Tweet I got a new hard drive (2.7Tb) but wanted to use it with a docking station. Here are the steps required to use it under my Fedora box. First, I naively went into the Nautilus File Browser hoping to … Continue reading

Posted in Linux | Tagged , | Leave a comment

AWK: convert into lower or upper cases

Tweet In order to convert a bash variable to lower case with awk, just use this command:

If you want to convert the content of a file (called data.csv) to lower case:

Of course to convert into upper … Continue reading

Posted in Linux | Tagged , | Leave a comment

How to sort a dictionary by values in Python

Tweet By definition, dictionary are not sorted (to speed up access). Let us consider the following dictionary, which stores the age of several persons:

If you want to sort this dictionary by values (i.e., the age), you must be … Continue reading

Posted in Python, Uncategorized | Tagged , | Leave a comment

Python: how to copy a list

Tweet To explain how to create a copy of a list, let us first create a list. We will use a simple list of 4 items:

Why do we want to create a copy anyway ? Well, because in … Continue reading

Posted in Python | Tagged , | Leave a comment

Python: ternary operator

Tweet In C language (and many other languages), there is a compact ternary conditional operator that is a compact if-else conditional construct. For instance, in C, a traditional if-else construct looks like:

and the equivalent ternary operator looks like: … Continue reading

Posted in Python | Leave a comment

Difference between __repr__ and __str__ in Python

Tweet When implementing a class in Python, you usually implement the __repr__ and __str__ methods. __str__ should print a readable message __repr__ should print a message that is unambigous (e.g. name of an identifier, class name, etc). You can see … Continue reading

Posted in Python | Tagged , | Leave a comment