-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathArmory_002_DBPR.py
More file actions
28 lines (22 loc) · 830 Bytes
/
Armory_002_DBPR.py
File metadata and controls
28 lines (22 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
'''
A solution to a ROSALIND bioinformatics problem from the Armory problem area,
which focuses on using prebuilt bioinformatics packages, in this case BioPython.
Problem Title: Introduction to Protein Databases
Rosalind Armory ID: DBPR
Rosalind Armory #: 002
URL: http://rosalind.info/problems/dbpr/
'''
from Bio import ExPASy
from Bio import SwissProt
with open('data/armory/rosalind_dbpr.txt') as input_data:
UniProt_ID = input_data.read().strip()
handle = ExPASy.get_sprot_raw(UniProt_ID)
record = SwissProt.read(handle)
bio_proc = []
for item in record.cross_references:
if item[0] == 'GO' and item[2][0]=='P':
bio_proc.append(item[2].lstrip('P:'))
print '\n'.join(bio_proc)
with open('output/armory/Armory_002_DBPR.txt', 'w') as output_data:
output_data.write('\n'.join(bio_proc))