diff --git a/xa2multi.pl b/xa2multi.pl index fff50fd3..1f4b2d32 100755 --- a/xa2multi.pl +++ b/xa2multi.pl @@ -9,7 +9,9 @@ print; my @t = split("\t"); while ($l =~ /([^,;]+),([-+]\d+),([^,]+),(\d+);/g) { - my $mchr = ($t[6] eq $1)? '=' : $t[6]; # FIXME: TLEN/ISIZE is not calculated! + my $mchr = ($t[6] eq '=') ? $t[2] : $t[6]; + my $mchr_ = ($mchr eq $1) ? '=' : $mchr; + # FIXME: TLEN/ISIZE is not calculated! my $seq = $t[9]; my $phred = $t[10]; # if alternative alignment has other orientation than primary, @@ -19,7 +21,7 @@ $seq =~ tr/ACGTacgt/TGCAtgca/; $phred = reverse $phred; } - 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"); + print(join("\t", $t[0], 0x100|($t[1]&0x6e9)|($2<0?0x10:0), $1, abs($2), 0, $3, $mchr_, $t[7], 0, $seq, $phred, "NM:i:$4"), "\n"); } } else { print; } }