Author Archives: Thomas Cokelaer

How to get pypi statistics about package download

A while ago, I designed pypiview, a Python package used to fetch the number of downloads for a package hosted on pypi website. It used to work decently but according to pypi itself the values stored are not reliable and … Continue reading

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

How to prevent wget from creating duplicates

wget is used to download file from internet. For instance: wget http://url/test.csvwget http://url/test.csv So far so good but two things may happen. First, you may interrupt the download. Second, you may load the file again. Sometimes, files are huge and … Continue reading

Posted in Linux | Tagged | Leave a comment

Meaning of Real, User and Sys time statistics

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: time dftime df The … Continue reading

Posted in Linux | 2 Comments

git : How to remove a big file wrongly committed

I added a large file to a git repository (102Mb), commited and push and got an error due to size limit limitations on github remote: error: GH001: Large files detected. You may want to try Git Large File Storage – … Continue reading

Posted in Computer Science | Tagged , | 43 Comments

git and github : skip password typing with https

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 use … Continue reading

Posted in Computer Science | Tagged | Leave a comment

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

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: samtools view -T reference.fa -b -o output.bam input.cram [sam_header_read2] 3366 sequences loaded. [sam_read1] reference … Continue reading

Posted in bioinformatics | Tagged | Leave a comment

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

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 see … Continue reading

Posted in Linux | Tagged , | Leave a comment

AWK: convert into lower or upper cases

In order to convert a bash variable to lower case with awk, just use this command: a="UPPER CASE" echo "$a" | awk ‘{print tolower($0)}’a="UPPER CASE" echo "$a" | awk ‘{print tolower($0)}’ If you want to convert the content of a … Continue reading

Posted in Linux | Tagged , | Leave a comment

How to sort a dictionary by values in Python

By definition, dictionary are not sorted (to speed up access). Let us consider the following dictionary, which stores the age of several persons as values: d = {"Pierre": 42, "Anne": 33, "Zoe": 24}d = {"Pierre": 42, "Anne": 33, "Zoe": 24} … Continue reading

Posted in Python | Tagged , | 7 Comments

Python: how to copy a list

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: list1 = [1, 2, "a", "b"]list1 = [1, 2, "a", "b"] Why do we want … Continue reading

Posted in Python | Tagged , | 2 Comments