biojet 0 Junior Poster in Training

Hi everyone,

I am trying to idetify the position between start_posi and end_posi and I want to have all information of this position. For Example:

input 1 : num    start    end 
                 1       1234    1238
input 2 : num    position   information 
                 1       1236      ACGT
out put 
      1234     1236    1238    ACTG

I try it with the link http://www.daniweb.com/software-development/perl/threads/378843 but I am not seccessful below that my script

use strict; 
use warnings; 
use autodie;  
my (%data1,%data2); 


# Open the data of LAO and genlist
  open my $in, '<', 'LAO1.txt';        
  while (<$in>) { 
    next unless /^\s*\d/;             
    my ($num, $posi) = split; 
    $data1{$num} = $posi; 
}  
  open $in, '<', 'genlist2.txt'; 
  while (<$in>) {  
   next unless /^\s*\d/; 
  my ($num, $star, $end, $ref, $mul) = split;  
   $data2{$num}{'star'} = $star;   
   $data2{$num}{'end'}  = $end;
   $data2{$num}{'ref'} = $ref;
   $data2{$num}{'mul'} = $mul;
 } 
close $in; 

#identify the position of LAO from genlist

 open (POSI,">PI.txt"); 
   for my $num (keys %data1) {        #sort the data1
    my $val = $data1{$num}; 
    for my $num2 (keys %data2) { 
        my $min = $data2{$num2}{'star'}; 
        my $max = $data2{$num2}{'end'}; 
        my $ref = $data2{$num2}{'ref'};
        my $mut = $data2{$num2}{'mul'};
	my $mod = ($val-$min ) % 3 + 1;
        my $int = int(($val-$min)/3);
        my $gia =($int*3)+$min;
	
     if ( ($val > $min) and ($val < $max) ) {  
	    print POSI $min.  "\t";
	    print POSI $val.  "\t";           
            print POSI $max.  "\t"; 
	    print POSI $gia.  "\t";
	    print POSI $mod.  "\t";
            print POSI $ref.   "\t";
	    print POSI $mut. "\n";
	   
            last;   
   
             }
    
         }
   
    } 
print " PI.txtを開くしてください。\n ";
print "Star_posi--Position-- End_posi--mod value です。\n";


 close(POSI)

Could you please show me how to solve that problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.