Skip to content

Instantly share code, notes, and snippets.

@ag1805x
Created August 22, 2019 10:35
Show Gist options
  • Save ag1805x/c4957a36f9debfc7d967854561c171ab to your computer and use it in GitHub Desktop.
Save ag1805x/c4957a36f9debfc7d967854561c171ab to your computer and use it in GitHub Desktop.
Code to extract GC% of genes from GFF file using bedtools
###########################################
# Code to extract GC% of genes from GFF file
# using bedtools
# - Arindam Ghosh (22 August 2019)
###########################################
bedtools nuc -fi Homo_sapiens.GRCh38.dna.primary_assembly.fa -bed Homo_sapiens.GRCh38.84.gff3 | grep ID=gene:ENSG > temp.txt
echo -e "GeneID\tpct_GC" > GRCh38_GeneGC.txt
paste <(cut -d: -f2 temp.txt | cut -d';' -f1) <(cut -f11 temp.txt) >> GRCh38_GeneGC.txt
rm temp.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment