Skip to content

Commit bce7ba4

Browse files
committed
Fix RNEXT output
1 parent 139f68f commit bce7ba4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

xa2multi.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
print;
1010
my @t = split("\t");
1111
while ($l =~ /([^,;]+),([-+]\d+),([^,]+),(\d+);/g) {
12-
my $mchr = ($t[6] eq $1)? '=' : $t[6]; # FIXME: TLEN/ISIZE is not calculated!
12+
my $mchr = ($t[6] eq '=') ? $t[2] : $t[6];
13+
my $mchr_ = ($mchr eq $1) ? '=' : $mchr;
14+
# FIXME: TLEN/ISIZE is not calculated!
1315
my $seq = $t[9];
1416
my $phred = $t[10];
1517
# if alternative alignment has other orientation than primary,
@@ -19,7 +21,7 @@
1921
$seq =~ tr/ACGTacgt/TGCAtgca/;
2022
$phred = reverse $phred;
2123
}
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");
24+
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");
2325
}
2426
} else { print; }
2527
}

0 commit comments

Comments
 (0)