From b77ec95d0b2450071bf263b07ed9f110797afb19 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 9 Jun 2011 11:22:23 -0400 Subject: [PATCH] Fix for either a bug or undocumented feature in ElementTree that broke megablast and blast+ XML parsing in Python 2.7. --- tools/metag_tools/megablast_xml_parser.py | 2 +- tools/ncbi_blast_plus/blastxml_to_tabular.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/metag_tools/megablast_xml_parser.py b/tools/metag_tools/megablast_xml_parser.py index bce89b1f956..89e8fea44d1 100644 --- a/tools/metag_tools/megablast_xml_parser.py +++ b/tools/metag_tools/megablast_xml_parser.py @@ -53,7 +53,7 @@ def __main__(): query = elem.findtext( "Iteration_query-def" ) qLen = elem.findtext( "Iteration_query-len" ) # for every within - for hit in elem.findall( "Iteration_hits/Hit/" ): + for hit in elem.findall( "Iteration_hits/Hit" ): subject = hit.findtext( "Hit_id" ) if re.search( '^gi', subject ): subject = subject.split('|')[1] diff --git a/tools/ncbi_blast_plus/blastxml_to_tabular.py b/tools/ncbi_blast_plus/blastxml_to_tabular.py index 795abebe892..0f258cf6853 100644 --- a/tools/ncbi_blast_plus/blastxml_to_tabular.py +++ b/tools/ncbi_blast_plus/blastxml_to_tabular.py @@ -138,7 +138,7 @@ for event, elem in context: qlen = int(elem.findtext("Iteration_query-len")) # for every within - for hit in elem.findall("Iteration_hits/Hit/"): + for hit in elem.findall("Iteration_hits/Hit"): #Expecting either this, # gi|3024260|sp|P56514.1|OPSD_BUFBU # RecName: Full=Rhodopsin