Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
the error message for above is "uninitailised value in numeric gt (>) <FASTA> andif( ($counter > $pos_end) && ($orf_counter < @orf_array_pos) ) and
in which the error message is "uninitalised vlaue in numeric le (<=) <FASTA> Maybe the problem is something to do with $pos_end. All the variables in these two lines are declared so i can't see the problem.if( ($counter >= $pos_start) && ($counter <= $pos_end) )
If it helps the program reads in strings of DNA and prints to an output file the bits that don't overlap. $counter reads along one string, and $orf_counter counts the position in the second file. $pos_start and $pos_end just refer to the start and stop positions of matches. The first command line input file contains three columns of data which are orf no, then start and stop positions of each orf. the second command line input file is a genome sequence. The program reads through the orf file trying to match the orfs to the genome sequence. Please help me monks, i need you!!!!!!
#! /usr/local/bin/perl -w use strict; my($num_of_params,$line,$key,$name); my @keys; my %orf_hash_pos; $num_of_params = @ARGV; if($num_of_params < 3) { die ("\n Not enough params have been entered!!!!\n"); } open (ORF_POS, $ARGV[0]) or die "unable to open file"; open (FASTA, $ARGV[1]) or die "unable to open file"; open (OUTFILE, ">$ARGV[2]"); foreach $line (<ORF_POS>) { if(! ($line =~ /(\d+)\s+(\d+)\s+(\d+)/)) { print "CHECK YOR FILE .... continue \n"; next; } if($2 <= $3) { $orf_hash_pos{$2} = $3; } else { $orf_hash_pos{$3} = $2; } } @keys = sort { $a <=> $b } ( keys %orf_hash_pos ); #--------------- step 2 --------------------------- my $counter=0; my $orf_counter=0; my $new_pos; my $pos_start=0; my $pos_end=0; my $found_new=0; my @lines; my @dna; my @orf_array_pos; my $base; my $dna; my $orf_names; @lines = <FASTA>; chomp @lines; $dna = join( '', @lines); @dna = split( '', $dna); foreach $key (@keys) { push @orf_array_pos , $key; push @orf_array_pos , $orf_hash_pos{$key}; } $pos_start = $orf_array_pos[$orf_counter]; $pos_end = $orf_array_pos[$orf_counter+1]; $found_new=0; foreach $base (@dna) { if( ($counter > $pos_end) && ($orf_counter < @orf_array_pos) ) { $orf_counter += 2; $new_pos = $orf_array_pos[$orf_counter]; if($new_pos < $pos_end) { $pos_start = $pos_end; } else { $pos_start = $new_pos; } $pos_end = $orf_array_pos[$orf_counter+1]; } if( ($counter >= $pos_start) && ($counter <= $pos_end) ) { $found_new=0; } else { if($found_new==0) { $orf_names = $orf_counter + 1; $found_new=1; print "\n\n> dORF$orf_names \n"; print OUTFILE "\n\n> dORF$orf_names \n"; } print $base; print OUTFILE $base; } $counter++; } print "\n";
Edit by tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uninitalised value in numeric
by jmcnamara (Monsignor) on May 22, 2002 at 12:22 UTC | |
|
Re: uninitalised value in numeric
by derby (Abbot) on May 22, 2002 at 12:15 UTC | |
|
Re: uninitalised value in numeric
by Android 18 (Novice) on May 22, 2002 at 12:05 UTC | |
by jmcnamara (Monsignor) on May 22, 2002 at 12:41 UTC |