Thanks I just coded it myself spending few hours. The extract() option looks cool.
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.
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:
"Sequence described by a feature or location" in the tutorial http://biopython.org/DIST/docs/tutorial/Tutorial.html
"Working with Sequence Features" here https://github.com/peterjc/biopython_workshop/blob/master/using_seqfeatures/README.rst
"Dealing with GenBank files in Biopython" (almost the same as EMBL files) here http://www.warwick.ac.uk/go/peter_cock/python/genbank/
Or, there is the built in help for the SeqFeature object.
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.
True, but not for extractfeat itself - https://github.com/biopython/biopython/blob/master/Bio/Emboss/Applications.py
Log in to answer this question.
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.