#!/usr/bin/perl

while(<>) {
	next if /^@|_random/;
	($ch, $sign1, $start, $sign2) = split;
	$mp{$ch . "#" . $sign2 . $start}++;
}

@anno = `cat sv_gene.txt`;
foreach(@anno) {
	($gene1, $gene2, $start, $end, $sign, $ch) = split;
	$sign = ($sign eq "F") ? 1 : -1;
	for ($i = $start; $i <= $end; $i++) {
		if ($mp{$ch . "#" . $sign . $i}) {
			print "$ch $sign $gene2 ", $i - $start + 1, " ",  $mp{$ch . "#" . $sign . $i}, "\n";
		}
	}
}


