Skip to content

Instantly share code, notes, and snippets.

@nachocab
Created September 18, 2013 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nachocab/6612983 to your computer and use it in GitHub Desktop.
Save nachocab/6612983 to your computer and use it in GitHub Desktop.
# Create a file with the awk code
echo '
$6 == "protein_coding" {
gene_counter[$10] += 1
}
END {
for (gene_name in gene_counter){
print gene_name, gene_counter[gene_name]
}
}' > gene_counter.awk
# run the code again
awk -F "\t" '$3 == "exon" { print $9 }' transcriptome.gtf | \
tr -d ";\"" | \
awk -F " " -f gene_counter.awk > number_of_exons_by_gene.txt
# see if it works now
head number_of_exons_by_gene.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment