Hi, I submitted this problem a few days ago and din't get much of a response (probably because I didn't explain it properly).... my program below is getting two errors messages and i really can't find anything wrong with it. the lines containing errors are:
if( ($counter > $pos_end) && ($orf_counter < @orf_array_pos) ) and
the error message for above is "uninitailised value in numeric gt (>) <FASTA> and
if( ($counter >= $pos_start) && ($counter <= $pos_end) )
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 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


In reply to uninitalised value in numeric by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.