chr start end
chr21 9411509 9411529
chr21 9411510 9411529
chr21 9411509 9411529
chr21 9411569 9411589
chr21 9411571 9411591
chr21 9411572 9411592
chr21 9411573 9411593
chr21 9411575 9411595
chr21 9411578 9411598
####
|-----|
|-----|
|-----|
|------|
####
|----|
|----|
|-----|
|-----|
####
TSSD_ID Start position End position Count overlapped
ID_1 XXXXX XXXXXX 54
####
#!/usr/bin/perl -w
use strict;
use warnings;
my $data = <>;
my $tol = 2;
my @chr;
my @start;
my @end;
my @count;
my @strand;
while ( $data = (<>) ) {
my (
$chr, $start, $end, $info,
$cnt, $strand, $start2, $end2,
$color, $cnt2, $length , $zero
)
= split( "\t", $data );
push( @chr, $chr);
push (@start, $start);
push (@end, $end);
push (@strand, $strand);
}
my $cl1length = @start;
my $cl2length = @end;
print "TSSD_ID \t Start \t End \t Count\t Strand \n" ;
foreach ( my $i =0 ; $i < $cl1length ; $i = $i++) {
for ( my $i = 1 ; $i < $cl1length ; $i++ ) {
my $ID = 1;
my $count = 0;
for (my $j = 0 ; $j < $cl2length ; $j++) {
if ( $tol < ( $start[$i] - $start[$i+1] ) ) { $ID++; }
if ($start[$i]-$start[$j] == 0) { $count++;}}
print "ID_$ID \t $chr[$i] \t $start[$i] \t $end[$i] $count \t $strand[$i] \n"; }}