[Bioperl-l] Bio::SearchIO::XML::BlastHandler problems

Rondon Neto rondonbio at yahoo.com.br
Wed Feb 15 18:59:15 UTC 2012


Hello everybody,
unffortunally I'm having problems with Bio::SearchIO, that I wasn't having before. Perl is returning this to me:
" Can't locate object method "_eventHandler" via package "Bio::SearchIO::XML::BlastHandler" at /usr/local/share/perl/5.10.1/Bio/SearchIO/blastxml.pm line 151. "

I believe it's happening because I installed a genome assembler that use a different version of Bio::SearchIO that I have before.


thank you,

Rondon

the subroutine that use this module is above:

sub nucleotide_coverage{
#Bio::SearchIO dependent
#This subroutine returns a Hash and a file with nucleotide coverage
#for each query in an blast alignment xlm file. The input is the
#alignment file and the name of output (just the index).
#USAGE:::  $ref = nucleotide_coverage("blast.xml", "gene_family");

        my ($alignment_file, $gene_family) = @_;


        my $alignment = new Bio::SearchIO ( -format => 'blastxml',
                                            -file   => $alignment_file );

        print "Parseando o resultado do BLAST\n";
        my %positions;
        my @used_reads;
        open OUT, ">reads_per_CDS.txt";
        while (my $result = $alignment->next_result) {
                my $query_name = $result->query_name();
                my $tam = $result -> query_length();
                for (0..$tam-1){ ${$positions{$query_name}}[$_] = 0 }
                while (my $hit = $result->next_hit) {
                        my $hit_name = $hit->name;
                        LABEL:
                        foreach my $read (@used_reads) {
                                if ( $read eq $hit_name ) {
                                        next LABEL;
                                }
                        }
                        print OUT "$query_name\t$hit_name\n";
                        while (my $hsp = $hit->next_hsp) {
                                my $query_name = $result->query_name();
                                my @pos = $hsp->seq_inds('query','identical');
                                foreach my $num (@pos) {
                                        ${$positions{$query_name}}[$num-1]++;
                                }
                        }
                push (@used_reads, $hit_name);
                }
        }
        close OUT;

        my $outfile = "nucleotide_coverage.txt";
        open OUT, ">$outfile" or die $!;
        foreach my $key (keys %positions){

                print OUT "$key\t@{$positions{$key}}\n";
        }

        close OUT;

        return \%positions;

}




More information about the Bioperl-l mailing list