comparison scripts/pickOverlapPair.ex.pl @ 21:9672fe07a232 draft default tip

planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
author mvdbeek
date Mon, 05 Dec 2016 09:58:47 -0500
parents 28d1a6f8143f
children
comparison
equal deleted inserted replaced
20:6e02b9179a24 21:9672fe07a232
54 my $rightlower=$right-500; 54 my $rightlower=$right-500;
55 my $rightupper=$right+500; 55 my $rightupper=$right+500;
56 my $chr_num=$a[0]; 56 my $chr_num=$a[0];
57 $chr_num =~ s/chr//; 57 $chr_num =~ s/chr//;
58 if (($chrs{$a[0]} == 1) && (! defined $chrs{$chr_num})) {$chr_num=$a[0];} 58 if (($chrs{$a[0]} == 1) && (! defined $chrs{$chr_num})) {$chr_num=$a[0];}
59 system("samtools view -Xf 0x2 $title $chr_num\:$leftlower\-$leftupper $chr_num\:$rightlower\-$rightupper > temp.sam"); 59 system("samtools view -f 0x2 $title $chr_num\:$leftlower\-$leftupper $chr_num\:$rightlower\-$rightupper > temp.sam");
60 60
61 open in,"temp.sam"; 61 open in,"temp.sam";
62 my %ps=(); 62 my %ps=();
63 my %me=(); 63 my %me=();
64 my %uniqp=(); 64 my %uniqp=();
68 while(<in>) 68 while(<in>)
69 { 69 {
70 chomp; 70 chomp;
71 my @f=split/\t/,$_,12; 71 my @f=split/\t/,$_,12;
72 ## read number 1 or 2 72 ## read number 1 or 2
73 my ($rnum)=$f[1]=~/(\d)$/; 73 #my ($rnum)=$f[1]=~/(\d)$/;
74 my $rnum=1;
75 if (($f[1] & 128) == 128) {$rnum=2;}
74 76
75 ## XT:A:* 77 ## XT:A:*
76 my ($xt)=$f[11]=~/XT:A:(.)/; 78 my ($xt)=$f[11]=~/XT:A:(.)/;
77 79
78 ## Coordinate 80 ## Coordinate
79 my $coor=$f[3]; 81 my $coor=$f[3];
80 if ($f[1]=~/r/) 82 if (($f[1] & 16) == 16)
81 { 83 {
82 if ($xt eq "U") {$uniqm{$f[0]}=1;} 84 if ($xt eq "U") {$uniqm{$f[0]}=1;}
83 my (@cigar_m)=$f[5]=~/(\d+)M/g; 85 my (@cigar_m)=$f[5]=~/(\d+)M/g;
84 my (@cigar_d)=$f[5]=~/(\d+)D/g; 86 my (@cigar_d)=$f[5]=~/(\d+)D/g;
85 my (@cigar_s)=$f[5]=~/(\d+)S/g; 87 my (@cigar_s)=$f[5]=~/(\d+)S/g;
86 my (@cigar_i)=$f[5]=~/(\d+)I/g; 88 my (@cigar_i)=$f[5]=~/(\d+)I/g;
87 my $aln_ln=sum(@cigar_m,@cigar_d); 89 my $aln_ln=sum(@cigar_m,@cigar_d);
88 $me{$f[0]}=$f[3]+$aln_ln-1; 90 $me{$f[0]}=$f[3]+$aln_ln-1;
89 } 91 }
90 elsif ($f[1]=~/R/) { 92 elsif (($f[1] & 32) == 32) {
91 $ps{$f[0]}=$f[3]; 93 $ps{$f[0]}=$f[3];
92 if ($xt eq "U") {$uniqp{$f[0]}=1;} 94 if ($xt eq "U") {$uniqp{$f[0]}=1;}
93 } 95 }
94 96
95 # ${$pe{$f[0]}}[$rnum-1]=[$xt,$coor]; 97 # ${$pe{$f[0]}}[$rnum-1]=[$xt,$coor];