view NEUMA-1.2.1/bowtieout2insertlendis.PE.pl @ 0:c44c43d185ef draft default tip

NEUMA-1.2.1 Uploaded
author chawhwa
date Thu, 08 Aug 2013 00:46:13 -0400
parents
children
line wrap: on
line source

#!/usr/bin/perl

if(@ARGV<2) { print "usage: $0 bowtiefile readlength > insertlendis_file\n"; exit; }

my $bowtiefile = shift @ARGV;
my $readlength = shift @ARGV;


open BOWTIE, $bowtiefile or die "Can't open bowtieout file $bowtiefile\n";
while(<BOWTIE>){
  chomp;
  my ($pos1) = (split/\t/)[3];
  chomp(my $secondline = <BOWTIE>);
  my ($pos2) = (split/\t/,$secondline)[3];
  my $dist = $pos2 + $readlength - $pos1;
  $Insert_lendis[$dist]++;

}
close BOWTIE;


for my $i (0..$#Insert_lendis){
   print "$i\t$Insert_lendis[$i]\n" if defined($Insert_lendis[$i]);
}