Mercurial > repos > portiahollyoak > temp
comparison scripts/pickUniqPos.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 | e19d9742c99b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:28d1a6f8143f |
---|---|
1 #!/share/bin/perl | |
2 use Bio::Seq; | |
3 use List::Util qw(sum); | |
4 | |
5 die "perl $0 <sam>\n" if @ARGV<1; | |
6 open in,$ARGV[0]; | |
7 my %pe; | |
8 while(<in>) | |
9 { | |
10 chomp; | |
11 my @f=split/\t/,$_,12; | |
12 ## read number 1 or 2 | |
13 my ($rnum)=$f[1]=~/(\d)$/; | |
14 | |
15 ## XT:A:* | |
16 my ($xt)=$f[11]=~/XT:A:(.)/; | |
17 | |
18 my $strand="+"; | |
19 ## revcomp | |
20 if($f[1]=~/r/) | |
21 { | |
22 my $seq=Bio::Seq->new(-seq=>$f[9]); | |
23 $f[9]=$seq->revcom->seq; | |
24 $strand="-"; | |
25 } | |
26 | |
27 ## parse CIGAR | |
28 if($xt eq "U") | |
29 { | |
30 # CIGAR | |
31 my (@cigar_m)=$f[5]=~/(\d+)M/g; | |
32 my (@cigar_d)=$f[5]=~/(\d+)D/g; | |
33 my (@cigar_s)=$f[5]=~/(\d+)S/g; | |
34 my (@cigar_i)=$f[5]=~/(\d+)I/g; | |
35 my $aln_ln=sum(@cigar_m,@cigar_d); | |
36 | |
37 print $f[2],"\t",$f[3]-1,"\t",$f[3]-1+$aln_ln,"\t$f[0]/$rnum\t",$f[9],"\t",$strand,"\n"; | |
38 } | |
39 } | |
40 close in; | |
41 |