-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgi_number_to_name.py
27 lines (24 loc) · 972 Bytes
/
gi_number_to_name.py
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
fin =
# Import the modules for interfacing with BLAST and parsing the output
from Bio.Blast import NCBIWWW, NCBIXML
# Blast the sequence of interest (in this case using the accession number
result_handle = NCBIWWW.qblast("blastn", "nr", filename)
# Parse the resulting output
blast_record = NCBIXML.read(result_handle)
# Loop over the alignments printing some output of interest
E_VALUE_THRESH = 0.004
for alignment in blast_record.alignments:
result = alignment.title
print('gi no.: '+str(result.split()))
print('gi-desc: '+' '.join(str(result.split())))
#print
## for hsp in alignment.hsps:
## if hsp.expect < E_VALUE_THRESH:
## print
## print '****Alignment****'
## print 'sequence:', alignment.title
## print 'length:', alignment.length
## print 'e value:', hsp.expect
## print hsp.query + '...'
## print hsp.match + '...'
## print hsp.sbjct + '...'