Skip to content

Commit

Permalink
A correct bug fix for the mateIsReverseStrand error I was seeing.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidadamsphd committed Sep 3, 2015
1 parent cae741e commit 7e267cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void setPosition( final String contig, final int start ) {

genomicsRead.getAlignment().getPosition().setReferenceName(contig);
// Convert from a 1-based to a 0-based position
genomicsRead.getAlignment().getPosition().setPosition((long) start - 1);
genomicsRead.getAlignment().getPosition().setPosition((long)start - 1);
}

@Override
Expand Down Expand Up @@ -249,7 +249,7 @@ public void setMatePosition( final String contig, final int start ) {
makeMatePositionIfNecessary();
genomicsRead.getNextMatePosition().setReferenceName(contig);
// Convert from a 1-based to a 0-based position
genomicsRead.getNextMatePosition().setPosition((long) start - 1);
genomicsRead.getNextMatePosition().setPosition((long)start - 1);
}

@Override
Expand Down Expand Up @@ -448,10 +448,8 @@ public boolean mateIsReverseStrand() {
if ( ! isPaired() ) {
throw new IllegalStateException("Cannot get mate information for an unpaired read");
}
final Position matePosition = genomicsRead.getNextMatePosition();
if ( matePosition == null ) { // @dr, is this right?
return false;
}

final Position matePosition = assertFieldValueNotNull(genomicsRead.getNextMatePosition(), "mate position");
return assertFieldValueNotNull(matePosition.getReverseStrand(), "mate strand");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static int getSAMFlagsForRead( final GATKRead read ) {
if ( read.isReverseStrand() ) {
samFlags |= SAM_READ_STRAND_FLAG;
}
if ( read.mateIsReverseStrand() ) {
if ( ! read.mateIsUnmapped() && read.mateIsReverseStrand() ) {
samFlags |= SAM_MATE_STRAND_FLAG;
}
if ( read.isFirstOfPair() ) {
Expand Down

0 comments on commit 7e267cd

Please sign in to comment.