Mercurial > repos > bioitcore > splicetrap
comparison bin/get.frag.size.pl @ 1:adc0f7765d85 draft
planemo upload
author | bioitcore |
---|---|
date | Thu, 07 Sep 2017 15:06:58 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d4ca551ca300 | 1:adc0f7765d85 |
---|---|
1 #for the results from paired end | |
2 #The two inputs are the results from the two ends | |
3 use strict; | |
4 my $read_size = $ARGV[2]; | |
5 open(input1, $ARGV[0]); | |
6 open(input2, $ARGV[1]); | |
7 open(output, ">$ARGV[0].fragsize"); | |
8 #open(fusefile,">$ARGV[0].fuse"); | |
9 | |
10 #my $LongMarker="L"; | |
11 #my $ShortMarker="S"; | |
12 | |
13 while(my $line1=<input1>) | |
14 { | |
15 my $line2=<input2>; | |
16 chomp($line1); | |
17 chomp($line2); | |
18 next if($line1=~/$\NM/ or $line2=~/$\NM/ or $line1=~/$\MT/ or $line2=~/$\MT/); | |
19 my @array1 = split("\t",$line1); | |
20 #my $read_size=length($array1[1]); | |
21 my @array2 = split("\t",$line2); | |
22 my $match1=$array1[3]; | |
23 my $match2=$array2[3]; | |
24 # my $marker=$LongMarker.$ShortMarker; | |
25 my @sizes=(); | |
26 #while($match1=~/\/(\S[^,]*\[[$marker]\])\S[^,]*:(\d*)[RF]/g) | |
27 while($match1=~/\/(\S[^,]*\[\w+\])\S[^,]*:(\d*)[RF]/g) | |
28 { | |
29 my $name=$1; | |
30 my $posa=$2; | |
31 #print $name,"\n"; | |
32 | |
33 if($match2=~/\Q$name\E\S[^,]*:(\d*)[RF]/) | |
34 { | |
35 #print "match\n"; | |
36 my $posb=$1; | |
37 push @sizes, abs($posb-$posa)+$read_size; | |
38 | |
39 } | |
40 | |
41 } | |
42 my %saw; | |
43 @saw{@sizes}=(); | |
44 my @keya= keys %saw; | |
45 #print scalar(@keya),"\n"; | |
46 if(scalar(@keya)==1) | |
47 { | |
48 print output $keya[0],"\n"; | |
49 } | |
50 | |
51 } | |
52 #close(fusefile); | |
53 close(output); | |
54 close(input2); | |
55 close(input1); |