comparison bwa-0.6.2/xa2multi.pl @ 0:dd1186b11b3b draft

Uploaded BWA
author ashvark
date Fri, 18 Jul 2014 07:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:dd1186b11b3b
1 #!/usr/bin/perl -w
2
3 use strict;
4 use warnings;
5
6 while (<>) {
7 if (/\tXA:Z:(\S+)/) {
8 my $l = $1;
9 print;
10 my @t = split("\t");
11 while ($l =~ /([^,;]+),([-+]\d+),([^,]+),(\d+);/g) {
12 my $mchr = ($t[6] eq $1)? '=' : $t[6]; # FIXME: TLEN/ISIZE is not calculated!
13 my $seq = $t[9];
14 my $phred = $t[10];
15 # if alternative alignment has other orientation than primary,
16 # then print the reverse (complement) of sequence and phred string
17 if ((($t[1]&0x10)>0) xor ($2<0)) {
18 $seq = reverse $seq;
19 $seq =~ tr/ACGTacgt/TGCAtgca/;
20 $phred = reverse $phred;
21 }
22 print(join("\t", $t[0], 0x100|($t[1]&0x6e9)|($2<0?0x10:0), $1, abs($2), 0, $3, @t[6..7], 0, $seq, $phred, "NM:i:$4"), "\n");
23 }
24 } else { print; }
25 }