I have tried to incorporate blast in my application using biopython.i could extract the blast results but now i want to extract the structure file corresponding matches. My code is :
from Bio.SeqIO import parse
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
file = open("prats.fasta")
records = parse(file,"fasta")
for record in records:
print("Id: %s" % record.id)
print("Name: %s" % record.name)
print("Description: %s" % record.description)
print("Annotations: %s" % record.annotations)
print("Sequence Data: %s" % record.seq)
print("Sequence Alphabet: %s" % record.seq.alphabet)
from Bio.Blast import NCBIWWW
sequence_data = open("prats.fasta").read()
sequence_data
result_handle = NCBIWWW.qblast("blastn", "nt", sequence_data)
result_handle
with open('results.xml', 'w') as save_file:
blast_results = result_handle.read()
print(blast_results)
save_file.write(blast_results)
from Bio.Blast import NCBIXML
E_VALUE_THRESH = 1e-20
for record in NCBIXML.parse(open("results.xml")):
if record.alignments:
print("\n")
print("query: %s" % record.query[:100])
for align in record.alignments:
for hsp in align.hsps:
if hsp.expect < E_VALUE_THRESH:
print("match: %s " % align.title[:100])
from here i want to generate the xml files and then fetch structure of each nucleotides results