hit.pl
#!/usr/bin/perl -w
use strict;
my $currentcontig = "";
my $min = 100000000000;
my $max = 0;
my $contador = 0;
my $strand;
my $currentstrand;
while (
chomp;
my @v = split ("\t",$_);
my $contig = $v[1];
my $minim = "";
my $maxim = "";
if ($v[8] < $v[9]) {
$minim = $v[8];
$maxim = $v[9];
$strand = 0;
}
else {
$minim = $v[9];
$maxim = $v[8];
$strand = 1;
}
if ($currentcontig eq $contig) {
if ($minim < $min) {
$min = $minim;
}
if ($maxim > $max) {
$max = $maxim;
}
}
else {
if ($currentcontig ne ""){
if ($currentstrand == 0) {
$min = $min - 50000;
if ($min < 0) {
$min = 0;
}
print $ARGV[0],"_",$contador, "\t", $currentcontig, "\t", $min, "\n";
}
else {
$max = $max - 50000;
if ($max < 0) {
$max = 0;
}
print $ARGV[0],"_",$contador, "\t", $currentcontig, "\t", $max, "\n";
}
}
$currentcontig = $contig;
$min = $minim;
$max = $maxim;
$contador ++;
$currentstrand = $strand;
}
}
if ($currentstrand == 0) {
$min = $min - 30000;
if ($min < 0) {
$min = 0;
}
print $ARGV[0],"_",$contador, "\t", $currentcontig, "\t", $min, "\n";
}
else {
$max = $max - 120000;
if ($max < 0) {
$max = 0;
}
print $ARGV[0],"_",$contador, "\t", $currentcontig, "\t", $max, "\n";
}