This is a test version of Biostars. For the public version, visit https://www.biostars.org.
message of Use of uninitialized value

Hi, I have a script in perl that use to extract each taxon obtained from qiime analyses, the script recognize the silva and greengenes format, but I just have one problem, in the line my @kingd=($taxon_value[0]=~m/D_0__(.);D_1|k__(.);p__/g); give me an msn of Use of uninitialized value $_, but if I use the match =~m/D_0__(.*);D_1/g for one option (in this case silva format) by now I just eliminate the warnings module, but I want tho know what is the problem, this is part of the script.

sub uniq {   my %seen;   grep !$seen{$_}++, @_; }

open INPUTFILE, "<", "$input", or die "can`t open file\n"; open OUTPUTFILE, ">", "$output" or die "can`t creat file\n";

 while (<INPUTFILE>){
    $line=$_;
    chomp($line);
        if ($line=~ m/^#/g){
            next;
        }

        elsif ($line=~ m/^unassigned/ig){
            next;
        }

        elsif ($line){
            my @full_line = $_;
            foreach (@full_line){
                my (@taxon_value)= split (/\t/, $_);

                    foreach ($taxon_value[0]){
                        if ($kingdom){
                            my @kingd=($taxon_value[0]=~m/D_0__(.*);D_1|k__(.*);p__/g);
                            foreach (@kingd){
                                if ($_=~/^$/){
                                    next;
                                }
                                elsif ($_=~ m/^unknown/ig){
                                    next;
                                }
                                elsif ($_=~ m/^(uncultured|unidentified)$/ig){
                                    next;
                                }
                                else {
                                    push @taxon_list, $_;
                                }
                            }     
                        }

                        elsif ($phylum){
                            my @phyl=($taxon_value[0]=~m/D_1__(.*);D_2|p__(.*);c__/g); #
                            foreach (@phyl){
                                if ($_=~ m/^$/g){
                                    next;
                                }
                                elsif ($_=~ m/^unknown/ig){
                                    next;
                                }
                                elsif ($_=~ m/^(uncultured|nidentified)$/ig){
                                    next;
                                }
                                else {
                                    push @taxon_list, $_;
                                }
                            }
                        }
                    }
            }
        }
              }

 @final_list = uniq @taxon_list;

    foreach (@final_list){
        print OUTPUTFILE "$_\n";
    } 

close INPUTFILE; close OUTPUTFILE;   exit;
perl qiime greengenes silva

0 answers

No answers yet.

Log in to answer this question.