-
Notifications
You must be signed in to change notification settings - Fork 0
/
blast.py
41 lines (31 loc) · 898 Bytes
/
blast.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
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /wynton/home/kortemme/krivacic/software/anaconda36/bin/python3
from prody import *
from Bio import SwissProt
import sys
import requests as r
from Bio import SeqIO
from io import StringIO
def run_blast(sequence):
#return blastPDB(sequence)
return blastPDB(sequence, sleep=11)
def get_sequence(cID):
#cID='P04637'
baseUrl="http://www.uniprot.org/uniprot/"
currentUrl=baseUrl+cID+".fasta"
response = r.post(currentUrl)
cData=''.join(response.text)
Seq=StringIO(cData)
return list(SeqIO.parse(Seq,'fasta'))
if __name__=='__main__':
#pdbid = sys.argv[1]
#run_blast(pdbid)
seq = get_sequence(sys.argv[1])
print(seq)
blasts = []
for s in seq:
print(str(s.seq))
blast = run_blast(str(s.seq))
blasts.append(blast)
for blast in blasts:
print(blast)
pdbs = blast.getHits(percent_identity=70)