This is a test version of Biostars. For the public version, visit https://www.biostars.org.
miRdeep2 mapper error

Hi everybody!

I'm using the following mapper script for miRNA alignment in miRdeep2, but the reads_vs_genome.arf is empty!

mapper.pl config_teste2.txt -d -e -h -j -l 18 -m -p /storage/raid/home/poliveira/from_ensembl/index -s reads_collapsed.fa -t reads_vs_genome.arf -v -n

and I'm having the following error message:

Use of uninitialized value $count2 in subtraction (-) at /usr/local/bioinfo/opt/mirdeep2_0_0_7/mapper.pl line 704.
total: 18969876 Use of uninitialized value $count2 in print at /usr/local/bioinfo/opt/mirdeep2_0_0_7/mapper.pl line 704.
        18969876        Use of uninitialized value $count2 in division (/) at /usr/local/bioinfo/opt/mirdeep2_0_0_7/mapper.pl line 705.
Use of uninitialized value $count2 in division (/) at /usr/local/bioinfo/opt/mirdeep2_0_0_7/mapper.pl line 705.

Please, could somebody help me?

Thanks

software-error alignment mirna

Try to run the same command without one of them. Let's see what happen.

Hi,

I tried without -t and I had the following message:

usage: /usr/local/bioinfo/opt/mirdeep2_0_0_7/convert_bowtie_output.pl reads_mapped.bwt

HI,

I think is like the alignment is empty, there is any temporary file directly from bowtie, any map or sam file? That part of the code is counting how many hits you have, but since it never enter the loop.

btw: answer should be only answer to the question, anything like comments, should be added using add comment button. :)

1 answer

The error is linked to the presence of options -s and -t that imply some statistics on outputs.

## get some statistics about mapped reads if options{'s'} and options{'t'} are supplied
if($options{'s'} and $options{'t'}){
    read_stats();
}

The part of the script that generates the error is the following. Maybe someone with more experience than me in perl can check it and add more comments. The variable $count2 is present only in this part of the code.

sub read_stats{
    my %hash;
    my $count;
    my %k2;
    my $total;

    open IN,"$options{'s'}" or die "No reads file in fasta format given\n";
    while(<IN>){
        if(/^>*((\S\S\S)\S+_x(\d+))/){
            next if($hash{$1});
            $hash{$1} = 1;
            $count+=$3;
            $k2{$2}+=$3;
        }
    }
    close IN;
    my %hash2;
    my $count2;
    my %k22;

    print STDERR "Mapping statistics\n";
    open IN, "$options{'t'}" or die "No mapping file given\n";
    while(<IN>){
        if(/^>*((\S\S\S)\S+_x(\d+))/){
            next if($hash2{$1});
            $hash2{$1} = 1;
            $count2+=$3;
            $k22{$2}+=$3;
        }
    }

    print STDERR "\n#desc\ttotal\tmapped\tunmapped\t%mapped\t%unmapped\n";
    print STDERR "total: ",$count,"\t",$count2,"\t",$count-$count2,"\t";
    printf STDERR "%.3f\t%.3f\n",$count2/$count,1-($count2/$count);
    foreach(sort keys %k2){
        print STDERR "$_: ",$k2{$_},"\t",$k22{$_},"\t",$k2{$_}-$k22{$_},"\t";
        printf STDERR "%.3f\t%.3f\n",$k22{$_}/$k2{$_},1-($k22{$_}/$k2{$_});
    }
}

Log in to answer this question.