diff scripts/pickOverlapPair.ex_MEM.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 ca36262102d8
children
line wrap: on
line diff
--- a/scripts/pickOverlapPair.ex_MEM.pl	Wed Oct 26 07:24:45 2016 -0400
+++ b/scripts/pickOverlapPair.ex_MEM.pl	Mon Dec 05 09:58:47 2016 -0500
@@ -56,7 +56,7 @@
     my $chr_num=$a[0];
     $chr_num =~ s/chr//;
     if (($chrs{$a[0]} == 1) && (! defined $chrs{$chr_num})) {$chr_num=$a[0];}
-    system("samtools view -Xf 0x2 $title $chr_num\:$leftlower\-$leftupper $chr_num\:$rightlower\-$rightupper > temp.sam");
+    system("samtools view -f 0x2 $title $chr_num\:$leftlower\-$leftupper $chr_num\:$rightlower\-$rightupper > temp.sam");
     
     open in,"temp.sam";
     my %ps=();
@@ -70,7 +70,9 @@
 	chomp;
 	my @f=split/\t/,$_,12;
 	## read number 1 or 2
-	my ($rnum)=$f[1]=~/(\d)$/;
+	#my ($rnum)=$f[1]=~/(\d)$/;
+        my $rnum=1;
+        if (($f[1] & 128) == 128) {$rnum=2;}
 	
 	## XT:A:* 
         my $xt="";
@@ -92,7 +94,7 @@
 	
 	## Coordinate
 	my $coor=$f[3];
-	if ($f[1]=~/r/)
+	if (($f[1] & 16) == 16)
 	{
 	    if ($xt eq "U") {$uniqm{$f[0]}=1;}
 	    my (@cigar_m)=$f[5]=~/(\d+)M/g;
@@ -102,7 +104,7 @@
 	    my $aln_ln=sum(@cigar_m,@cigar_d);
 	    $me{$f[0]}=$f[3]+$aln_ln-1;
 	}
-	elsif ($f[1]=~/R/) {
+	elsif (($f[1] & 32) == 32) {
 	    $ps{$f[0]}=$f[3];
 	    if ($xt eq "U") {$uniqp{$f[0]}=1;}
 	}