Quantcast
Channel: Post Feed
Viewing all articles
Browse latest Browse all 41826

Problem Parsing Xml In Biopython

$
0
0
Hi mates, I m new in python and I m trying to parse a result from local Blast...here the code.from Bio.Blast.Applications import NcbiblastpCommandline from Bio.Blast import NCBIStandalone from Bio.Blast import NCBIXML name = "virusprotein.fa" data_base = "virusprot.fa" out_file = "blast_test.xml" blastp_cline = NcbiblastpCommandline(query=name, db=data_base, evalue=0.001, out=out_file) print "hi" # code works until here to parse results in xml result_handle = open("blast_test.xml") blast_records = NCBIXML.parse(result_handle) blast_record = blast_records.next() #for alignment in blast_record.alignments: #for hsp in alignment.hsps: #if hsp.expect < evalue: #print 'Sequence:', alignment.title #print 'Length:', alignment.length #print 'E value:', hsp.expect #print hsp.query[0:50] + '...' #print hsp.match[0:50] + '...' #print hsp.sbjct[0:50] + '...' As you can see in commented code, its a module for parsing and a class to print a summary, actually this work when I do Blast on Internet, but not when I do it locally. The code ony works until (print "hi"). When I try to execute the code bellow it says : Traceback (most recent call last): File "blast_all.py", line 14, in <module> blast_record = blast_records.next() File "/usr/local/lib/python2.7/dist-packages/biopython-1.58-py2.7-linux-i686.egg/Bio/Blast/NCBIXML.py", line 624, in parse % (XML_START, ...

Viewing all articles
Browse latest Browse all 41826

Trending Articles