diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NEUMA-1.2.1/bowtieout2insertlendis.PE.pl	Thu Aug 08 00:46:13 2013 -0400
@@ -0,0 +1,25 @@
+#!/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]);
+}
+