annotate scripts/pickUniqPairFastq.pl.orig @ 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
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
1 #!/share/bin/perl
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
2 use Bio::Seq;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
3
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
4 die "perl $0 <sam> <output prefix>\n" if @ARGV<1;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
5
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
6 open m1,">$ARGV[1].1.fastq";
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
7 open m2,">$ARGV[1].2.fastq";
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
8
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
9 open in,$ARGV[0];
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
10 my %pe;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
11 while(<in>)
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
12 {
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
13 chomp;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
14 my @f=split/\t/,$_,12;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
15 ## read number 1 or 2
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
16 my ($rnum)=$f[1]=~/(\d)$/;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
17
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
18 ## XT:A:*
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
19 my ($xt)=$f[11]=~/XT:A:(.)/;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
20
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
21 ## revcom the read mapped to the reverse strand
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
22 if($f[1]=~/r/)
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
23 {
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
24 my $seq=Bio::Seq->new(-seq=>$f[9], -alphabet => 'dna');
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
25 $f[9]=$seq->revcom->seq;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
26 $f[10]=reverse $f[10];
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
27 }
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
28 if (($rnum == 1) || ($rnum == 2))
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
29 {
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
30 ${$pe{$f[0]}}[$rnum-1]=[$xt,$f[9],$f[10]];
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
31 }
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
32 }
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
33 close in;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
34
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
35 foreach my $id (keys %pe)
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
36 {
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
37 my @rid=@{$pe{$id}};
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
38 if (($rid[0][1] ne "") && ($rid[1][1] ne "") && (($rid[0][0] eq "U" || $rid[1][0] eq "U")))
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
39 {
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
40 print m2 "@"."$id/2","\n",$rid[1][1],"\n","+$id/2","\n",$rid[1][2],"\n";
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
41 print m1 "@"."$id/1","\n",$rid[0][1],"\n","+$id/1","\n",$rid[0][2],"\n";
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
42 }
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
43 }
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
44 close m1;
9672fe07a232 planemo upload for repository https://github.com/portiahollyoak/Tools commit 0fea84d05f8976b8360a8b4943ecb01b87e3ade0-dirty
mvdbeek
parents:
diff changeset
45 close m2;