Moving to the Dark Side

Leaving the Pipette for a Keyboard.

One liners, snippets and small scripts

Often I use one liners or small scripts for useful task but I keep forgetting about those. So I’ll just put them here for future reference.

Count number occurrences in a column/field. In this case, how many lines in a GFF3 file exist for each chromosome.

  
cut -f1 hg19.GFF3 | sort | uniq  -c | sort  

This can be further refined and count only genes per chromosome using a simple grep:

  
grep "gene" hg19.GFF3 | cut -f1 | sort | uniq  -c | sort