I have two data sets: 'Data 1' and 'Data 2'. Could you please help me to find, for each value of posi in 'Data 1', the ranges in 'Data 2' where posi lies between Star_posi and end_posi.
Data 1
Num posi
1 2
2 14
3 18
4 19
... ...
Data 2
Num Star_posi End_posi
1 1 10
2 3 15
3 17 21
4 23 34
... ... ...
Output
- Data 1 at posi 2 contained in Data 2 between star_posi 1 and end_posi 10.
- Data 1 at posi 14 contained in Data 2 between star_posi 3 and end_posi 15.
I want to identify the rows in Data 2 where the value in Data 1 is contained in the range of the row in Data 2. I made the script below, but I did not get far.
#!/usr/bin/perl -w
use strict;
use warnings;
use Data:ump qw(dump);
#Sort the position**************
my (@posi1, $Num2, @Num2, @Num1);
open(POS1,"<posi.txt");
@posi1=<POS1>;
@Num1=@posi1;
open(LIST,">list.txt"); {
@Num2= sort {$a <=> $b} @Num1;
$Num2 = join( '', @Num2);
print $Num2;
print LIST $Num2."\n";
}
close(LIST);
I would appreciate if you could give some pointers.`