comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:c44c43d185ef
1 #!/usr/bin/perl
2
3 if(@ARGV<2) { print "usage: $0 bowtiefile readlength > insertlendis_file\n"; exit; }
4
5 my $bowtiefile = shift @ARGV;
6 my $readlength = shift @ARGV;
7
8
9 open BOWTIE, $bowtiefile or die "Can't open bowtieout file $bowtiefile\n";
10 while(<BOWTIE>){
11 chomp;
12 my ($pos1) = (split/\t/)[3];
13 chomp(my $secondline = <BOWTIE>);
14 my ($pos2) = (split/\t/,$secondline)[3];
15 my $dist = $pos2 + $readlength - $pos1;
16 $Insert_lendis[$dist]++;
17
18 }
19 close BOWTIE;
20
21
22 for my $i (0..$#Insert_lendis){
23 print "$i\t$Insert_lendis[$i]\n" if defined($Insert_lendis[$i]);
24 }
25