Look in the XMl file for instances where you have multiple <Hit_hsps> tags within a <Hit> or multiple <Hsp> tags within a <Hit_hsps>.
This test data replicates your error
Update : Try this<?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "http://ww +w.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd"> <BlastOutput> <BlastOutput_iterations> <Iteration> <Iteration_hits> <Hit> <Hit_num>1</Hit_num> <Hit_def>Uncultured Sulfuricurvum sp. RIFRC-1, complete genome</Hit_ +def> <Hit_hsps> <Hsp> <Hsp_identity>16</Hsp_identity> </Hsp> </Hit_hsps> </Hit> <Hit> <Hit_num>2</Hit_num> <Hit_def>Neosartorya fischeri NRRL 181 conserved hypothetical protei +n (NFIA_106270) partial mRNA</Hit_def> <Hit_hsps> <Hsp> <Hsp_identity>16</Hsp_identity> </Hsp> </Hit_hsps> <Hit_hsps> <Hsp> <Hsp_identity>16a</Hsp_identity> </Hsp> <Hsp> <Hsp_identity>16b</Hsp_identity> </Hsp> </Hit_hsps> </Hit> </Iteration_hits> </Iteration> </BlastOutput_iterations> </BlastOutput>
#!perl use strict; use warnings; use XML::Simple; use Data::Dump 'pp'; # force these tags into array my $blast = XMLin('BLAST2.XML',ForceArray=>['Hit','Hit_hsps','Hsp']); my $hits = $blast->{BlastOutput_iterations}->{Iteration}->{Iteration_h +its}->{Hit}; my $ret; foreach my $hit (@{$hits}) { my @Hsp_identity; for my $Hit_hsps ( @{$hit->{Hit_hsps}} ){ for ( @{$Hit_hsps->{'Hsp'}} ) { push @Hsp_identity, $_->{'Hsp_identity'} } }; push @{$ret},join '|', $hit->{Hit_def}, $hit->{Hit_num}, @Hsp_identity; }; pp $ret;
In reply to Re^7: multiple XML fields in one line
by poj
in thread multiple XML fields in one line
by smice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |