This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extracting All Cds From A Embl File

I am trying to extract all the DNA sequence corresponding to the CDS using Biopython. However CDS region seems to be in different format in each embl file which makes it difficult to parse e.g.

join{[373615:374161](+), [0:174](+)}

[118940:>119261](-)

[<13907:>13991](+)

join{[426644:426858](+), [0:617](-)}

join{[5947..6076](+), [0..399](+)}

etc.

So I am wondering if there is any tool available for this purpose. Thank you.

biopython

The INSDC member databases (EMBL-EBI EMBL-Bank, NCBI GenBank and DDBJ) all use the same feature format, which is described in The DDBJ/EMBL/GenBank Feature Table Definition. See section "3.4.3 Location examples" for a set of examples illustrating the various possibilities for the feature location.

2 answers

Biopython will create a SeqFeature for each feature, including the CDS objects, with a complex location object (it has been parsed for you!). It provides an .extract(...) method precisely for this task - getting the sequence described. For examples, see:

Or, there is the built in help for the SeqFeature object.

Thanks I just coded it myself spending few hours. The extract() option looks cool.

While not in BioPython, it may provide a useful alternative... EMBOSS provides the extractfeat program to extract sequence data from a database entry based on a specific feature type (e.g. CDS).

Biopython has EMBOSS bindings.

Log in to answer this question.