Bug fix for read pos rank sum test annotation. Shouldn't be using the un-hardclipped start as the alignment start.
This commit is contained in:
parent
735b59d942
commit
429ad44421
|
|
@ -56,12 +56,12 @@ public class ReadPosRankSumTest extends RankSumTest {
|
|||
continue;
|
||||
|
||||
for ( final GATKSAMRecord read : alleleBin.getValue() ) {
|
||||
final int offset = ReadUtils.getReadCoordinateForReferenceCoordinate( read.getUnclippedStart(), read.getCigar(), refLoc, ReadUtils.ClippingTail.RIGHT_TAIL, true );
|
||||
final int offset = ReadUtils.getReadCoordinateForReferenceCoordinate( read.getSoftStart(), read.getCigar(), refLoc, ReadUtils.ClippingTail.RIGHT_TAIL, true );
|
||||
if ( offset == ReadUtils.CLIPPING_GOAL_NOT_REACHED )
|
||||
continue;
|
||||
int readPos = AlignmentUtils.calcAlignmentByteArrayOffset( read.getCigar(), offset, false, false, 0, 0 );
|
||||
|
||||
final int numAlignedBases = AlignmentUtils.getNumAlignedBases( read );
|
||||
final int numAlignedBases = AlignmentUtils.getNumAlignedBasesCountingSoftClips( read );
|
||||
if (readPos > numAlignedBases / 2)
|
||||
readPos = numAlignedBases - (readPos + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -342,6 +342,18 @@ public class AlignmentUtils {
|
|||
return n;
|
||||
}
|
||||
|
||||
public static int getNumAlignedBasesCountingSoftClips(final SAMRecord r) {
|
||||
int n = 0;
|
||||
final Cigar cigar = r.getCigar();
|
||||
if (cigar == null) return 0;
|
||||
|
||||
for (final CigarElement e : cigar.getCigarElements())
|
||||
if (e.getOperator() == CigarOperator.M || e.getOperator() == CigarOperator.S)
|
||||
n += e.getLength();
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
public static byte[] alignmentToByteArray(final Cigar cigar, final byte[] read, final byte[] ref) {
|
||||
|
||||
final byte[] alignment = new byte[read.length];
|
||||
|
|
|
|||
Loading…
Reference in New Issue