Merge pull request #723 from broadinstitute/eb_fix_rna_splitting_PT77878554

Make sure that the OverhangFixingManager (used for splitting RNA reads) ...
This commit is contained in:
Eric Banks 2014-09-02 20:39:01 -04:00
commit 01e725cd1a
3 changed files with 21 additions and 4 deletions

View File

@ -232,7 +232,7 @@ public class OverhangFixingManager {
*/ */
private void fixSplit(final SplitRead read, final Splice splice) { private void fixSplit(final SplitRead read, final Splice splice) {
// if the read doesn't even overlap the split position then we can just exit // if the read doesn't even overlap the split position then we can just exit
if ( !splice.loc.overlapsP(read.loc) ) if ( read.loc == null || !splice.loc.overlapsP(read.loc) )
return; return;
if ( isLeftOverhang(read.loc, splice.loc) ) { if ( isLeftOverhang(read.loc, splice.loc) ) {
@ -326,7 +326,8 @@ public class OverhangFixingManager {
public void setRead(final GATKSAMRecord read) { public void setRead(final GATKSAMRecord read) {
if ( !read.isEmpty() ) { if ( !read.isEmpty() ) {
this.read = read; this.read = read;
loc = genomeLocParser.createGenomeLoc(read.getReferenceName(), read.getSoftStart(), read.getSoftEnd()); if ( ! read.getReadUnmappedFlag() )
loc = genomeLocParser.createGenomeLoc(read.getReferenceName(), read.getSoftStart(), read.getSoftEnd());
} }
} }
} }

View File

@ -161,8 +161,6 @@ public class SplitNCigarReads extends ReadWalker<GATKSAMRecord, OverhangFixingMa
catch (FileNotFoundException ex) { catch (FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(toolkit.getArguments().referenceFile, ex); throw new UserException.CouldNotReadInputFile(toolkit.getArguments().referenceFile, ex);
} }
} }
@Override @Override

View File

@ -50,6 +50,8 @@ import org.broadinstitute.gatk.utils.BaseTest;
import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.utils.GenomeLoc;
import org.broadinstitute.gatk.utils.GenomeLocParser; import org.broadinstitute.gatk.utils.GenomeLocParser;
import org.broadinstitute.gatk.utils.fasta.CachingIndexedFastaSequenceFile; import org.broadinstitute.gatk.utils.fasta.CachingIndexedFastaSequenceFile;
import org.broadinstitute.gatk.utils.sam.ArtificialSAMUtils;
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
@ -169,4 +171,20 @@ public class OverhangFixingManagerUnitTest extends BaseTest {
final OverhangFixingManager manager = new OverhangFixingManager(null, genomeLocParser, referenceReader, 10000, 1, 40, false); final OverhangFixingManager manager = new OverhangFixingManager(null, genomeLocParser, referenceReader, 10000, 1, 40, false);
Assert.assertEquals(manager.overhangingBasesMismatch(read, readStart, ref, refStart, overhang), expected, new String(read) + " vs. " + new String(ref) + " @" + overhang); Assert.assertEquals(manager.overhangingBasesMismatch(read, readStart, ref, refStart, overhang), expected, new String(read) + " vs. " + new String(ref) + " @" + overhang);
} }
@Test
public void testUnmappedReadsDoNotFail() {
// create an unmapped read
final GATKSAMRecord read = new GATKSAMRecord(ArtificialSAMUtils.createArtificialSamHeader());
read.setReadName("foo");
read.setReferenceName("*");
read.setAlignmentStart(100);
read.setCigarString("*");
read.setReadUnmappedFlag(true);
// try to add it to the manager
final OverhangFixingManager manager = new OverhangFixingManager(null, null, null, 100, 1, 30, false);
manager.addRead(read); // we just want to make sure that the following call does not fail
Assert.assertTrue(true);
}
} }