Parsing A Uniprot Flat File
2
1
Entering edit mode
13.8 years ago
Deepu ▴ 10

Can anybody please let me know or help with parsing a uniprot flat file and access the information in the annotation (FT) line and produce an output file in python script. FT line is the one in a general uniprot flat file describing the nature of the proteins. Script written to this must produce an output file with the information in this line.

python biopython parsing uniprot • 8.0k views
ADD COMMENT
0
Entering edit mode

homework ? what did you try so far ?

ADD REPLY
0
Entering edit mode

Can you use Biopython?

ADD REPLY
0
Entering edit mode

I think we can use biopython. Its not homework but part of project.

ADD REPLY
0
Entering edit mode

Please don't forget to accept one of the answers below, the problem appears to be solved.

ADD REPLY
10
Entering edit mode
13.8 years ago
Chris ★ 1.6k

With BioPython, the task to access the feature information is very simple:

from Bio import SwissProt
for record in SwissProt.parse(open('/path/to/your/uniprot_sprot.dat')):
  for feature in record.features:
    print feature

How to save that into a file is also very simple.

Chris

ADD COMMENT
7
Entering edit mode
13.8 years ago
Neilfws 49k

If you can use BioPython, see Chapter 9: Swiss-Prot and ExPASy in the tutorial.

Alternative quick and dirty approach:

grep ^FT myfile.dat

Although that will not deal well with feature descriptions that span several lines.

ADD COMMENT

Login before adding your answer.

Traffic: 1915 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6