in reply to Sliding window perl program
BTW, I basically kept your syntax almost unchanged for the first part and tried to improve it in accordance to good practices in the second part. Take a look at the differences.# opening file 1 # ... my %hash; while (my $line1=<TR>) { chomp($line1); my @ar = split(/\t/,$line1); $hash{$ar[1]} = $ar[3]; } close TR; open my $SC, "<", $file2 or die "Error blah blah... $!"; while (my $line2 = <$SC>) { my ($id, $val) = split /\t/, $line2; my $val_file1 = $hash{$id}; if ( $val > $val_file1 - $margin and $val < $val_file1 + $margin) +{ # print out something } } close $SC;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sliding window perl program
by genome (Novice) on Oct 21, 2015 at 18:02 UTC | |
by Laurent_R (Canon) on Oct 21, 2015 at 23:18 UTC | |
by genome (Novice) on Oct 22, 2015 at 14:27 UTC | |
by Laurent_R (Canon) on Oct 22, 2015 at 18:56 UTC | |
by Laurent_R (Canon) on Oct 22, 2015 at 21:20 UTC |