This is a test version of Biostars. For the public version, visit https://www.biostars.org.
GC content calculation in percentage

Hello!

I have an output of DNA sequences generated in the CSV file format. I would like to know the percentage of GC Content. Is there any way I can write a command statement in Linux to get the GC content in percentage?

Many thanks!

linux gc-content

2 answers

There is a bioinformatics tool for linux called Emboss which is great for such tasks. The emboss command you want is geecee

$ sudo apt update && sudo apt install emboss
$ geecee mtdna.fa 
Calculate fractional GC content of nucleic acid sequences
Output file [nc_012920.geecee]: 
$ cat nc_012920.geecee
#Sequence   GC content
NC_012920.1   0.44

In Python using the PyDNA library:

https://medium.com/mlearning-ai/apply-machine-learning-algorithms-for-genomics-data-classification-132972933723#c97e

dna_sequence_string = "ATATATCCCGGGAATTTTCGTAGTTAGGCTGATTTTATTGGCGCGAAAATTT"
gc_content = PyDNA.dna_count_gc_content(dna_sequence_string)
print(“DNA sequence string:\n{}”.format(dna_sequence_string))
print(“GC-content:\n{}”.format(gc_content))

Result:

DNA sequence string: ATATATCCCGGGAATTTTCGTAGTTAGGCTGATTTTATTGGCGCGAAAATTT

GC-content: 36.5%

Log in to answer this question.