Mercurial > repos > portiahollyoak > temp
annotate scripts/pickSoftClipping.over.pl @ 0:28d1a6f8143f draft
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
author | portiahollyoak |
---|---|
date | Mon, 25 Apr 2016 13:08:56 -0400 |
parents | |
children | 9672fe07a232 |
rev | line source |
---|---|
0
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
1 #!/share/bin/perl |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
2 use Bio::Seq; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
3 use List::Util qw(sum); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
4 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
5 die "perl $0 <*.excision.cluster.rpmk> <Reference.2bit>\n" if @ARGV<1; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
6 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
7 my $title=$ARGV[0]; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
8 if ($title =~ /annotation/) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
9 $title =~ s/excision.cluster.annotation/sorted.bam/; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
10 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
11 else {$title =~ s/excision.cluster.rpmk/sorted.bam/;} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
12 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
13 my %chrs=(); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
14 system("samtools view -H $title > header"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
15 open (input, "<header") or die "Can't open header since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
16 while (my $line=<input>) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
17 if ($line =~ /^\@SQ/) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
18 my @a=split(/\t/, $line); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
19 for my $j (0..$#a) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
20 if ($a[$j] =~ /^SN:/) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
21 $a[$j] =~ s/^SN://; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
22 $chrs{$a[$j]}=1; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
23 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
24 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
25 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
26 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
27 close input; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
28 system("rm header"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
29 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
30 open (input, "<$ARGV[0]") or die "Can't open $ARGV[0] since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
31 while (my $line=<input>) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
32 chomp($line); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
33 my @a=split(/\s+/, $line); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
34 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
35 my $lower=$a[3]-100; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
36 my $upper=$a[4]+100; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
37 my $chr_num=$a[2]; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
38 $chr_num =~ s/chr//; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
39 if (($chrs{$a[2]} == 1) && (! defined $chrs{$chr_num})) {$chr_num=$a[2];} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
40 system("samtools view -bu $title $chr_num\:$lower\-$upper > temp.bam"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
41 system("samtools view -Xf 0x2 temp.bam > temp.sam"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
42 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
43 my $leftseq=""; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
44 my $rightseq=""; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
45 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
46 my $ll=$a[3]-150; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
47 my $lu=$a[3]+150; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
48 system("twoBitToFa $ARGV[1] -seq=$a[2] -start=$ll -end=$lu left.fa"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
49 open (seq, "<left.fa") or die "Can't open left.fa since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
50 my $head=<seq>; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
51 for my $k (0..5) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
52 $head=<seq>; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
53 chomp($head); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
54 $leftseq=$leftseq."$head"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
55 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
56 $leftseq=uc($leftseq); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
57 close seq; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
58 system("rm left.fa"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
59 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
60 my $rl=$a[4]-150; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
61 my $ru=$a[4]+150; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
62 system("twoBitToFa $ARGV[1] -seq=$a[2] -start=$rl -end=$ru right.fa"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
63 open (seq, "<right.fa") or die "Can't open right.fa since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
64 my $head=<seq>; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
65 for my $k (0..5) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
66 $head=<seq>; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
67 chomp($head); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
68 $rightseq=$rightseq."$head"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
69 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
70 $rightseq=uc($rightseq); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
71 close seq; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
72 system("rm right.fa"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
73 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
74 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
75 open in,"temp.sam"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
76 my %pe=(); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
77 while(<in>) |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
78 { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
79 chomp; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
80 my @f=split/\t/,$_,12; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
81 ## read number 1 or 2 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
82 my ($rnum)=$f[1]=~/(\d)$/; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
83 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
84 ## XT:A:* |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
85 my ($xt)=$f[11]=~/XT:A:(.)/; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
86 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
87 my $CIGAR=$f[5]; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
88 $CIGAR =~ s/S//g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
89 if ($f[5]=~/S/) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
90 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
91 ## Coordinate |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
92 my $coor=-10; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
93 my $overcoor=-10; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
94 my $strand=""; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
95 my @z=split(/M/, $f[5]); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
96 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
97 if (($f[5]=~/S$/)&&($f[1]=~/r/)) |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
98 { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
99 my (@cigar_m)=$f[5]=~/(\d+)M/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
100 my (@cigar_d)=$f[5]=~/(\d+)D/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
101 my (@cigar_s)=$f[5]=~/(\d+)S/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
102 my (@cigar_i)=$f[5]=~/(\d+)I/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
103 my $aln_ln=sum(@cigar_m,@cigar_d); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
104 $coor=$f[3]+$aln_ln-1; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
105 $strand="-"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
106 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
107 my (@clipped)=$z[1]=~/(\d+)S/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
108 my $cliplen=sum(@clipped); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
109 # print "$f[0]\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
110 # print "$cliplen\t"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
111 if ($cliplen >= 10) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
112 my $clipseq=substr($f[9], length($f[9])-$cliplen, $cliplen); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
113 $overcoor = index($rightseq, $clipseq); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
114 # print "$clipseq\t$rightseq\t$overcoor\t"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
115 if ($overcoor > -1) {$overcoor += ($a[4] - 149);} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
116 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
117 # print "\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
118 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
119 elsif (($f[1]=~/R/)&&($z[0]=~/S/)) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
120 $coor=$f[3]; $strand="+"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
121 my (@clipped)=$z[0]=~/(\d+)S/g; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
122 my $cliplen=sum(@clipped); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
123 # print "$f[0]\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
124 # print "$cliplen\t"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
125 if ($cliplen >= 10) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
126 my $clipseq=substr($f[9], 0, $cliplen); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
127 $overcoor = index($leftseq, $clipseq); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
128 # print "$clipseq\t$leftseq\t$overcoor\t"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
129 if ($overcoor > -1) {$overcoor += ($a[3] - 150 + $cliplen);} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
130 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
131 # print "\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
132 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
133 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
134 if ($coor > 0) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
135 my $final=""; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
136 if ($overcoor > 0) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
137 if ($strand eq "-") {$final="$coor\-$overcoor"."\($strand\)";} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
138 else {$final="$overcoor\-$coor"."\($strand\)";} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
139 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
140 else {$final=$coor."\($strand\)";} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
141 if (defined $pe{$final}) {$pe{$final}++;} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
142 else {$pe{$final}=1;} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
143 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
144 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
145 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
146 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
147 close in; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
148 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
149 my $clip_site=""; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
150 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
151 foreach my $coor (keys %pe) |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
152 { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
153 if ($pe{$coor} >= 2) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
154 $clip_site=$clip_site."$coor\:$pe{$coor}\;"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
155 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
156 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
157 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
158 chop($clip_site); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
159 print "$a[2]\t$a[3]\t$a[4]\t$a[5]\t$clip_site\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
160 system("rm temp.sam temp.bam"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
161 # last; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
162 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
163 |