use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.
the class GATKReadAdaptersUnitTest method readNumberTestData.
@DataProvider(name = "ReadNumberTestData")
public Object[][] readNumberTestData() {
SAMRecord secondOfPairSam = basicSAMRecord();
secondOfPairSam.setSecondOfPairFlag(true);
secondOfPairSam.setFirstOfPairFlag(false);
Read secondOfPairGoogleRead = basicGoogleGenomicsRead();
secondOfPairGoogleRead.setReadNumber(1);
return new Object[][] { { basicReadBackedBySam(), true, false }, { basicReadBackedByGoogle(), true, false }, { new SAMRecordToGATKReadAdapter(secondOfPairSam), false, true }, { new GoogleGenomicsReadToGATKReadAdapter(secondOfPairGoogleRead), false, true } };
}
use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.
the class GATKReadAdaptersUnitTest method getAndSetMatePositionData.
@DataProvider(name = "GetAndSetMatePositionData")
public Object[][] getAndSetMatePositionData() {
final SAMRecord samWithUnmappedMate = basicSAMRecord();
samWithUnmappedMate.setMateUnmappedFlag(true);
final Read googleReadWithUnmappedMate = basicGoogleGenomicsRead();
// NOTE: we're taking advantage here of a quirk of the current adapter implementation to allow us to run
// all the getSAMString tests.
//
// The GoogleGenomicsReadToGATKReadAdapter throws if the caller attempts to call isMateReverseStrand
// when it has never previously been explicitly set to true or false, but we need to query it in order
// to get the flags needed for getSAMString. In order to ensure that all of the getSAMString tests here
// can query this flag, we artificially set a matePosition with no position value but with the reverseStrandFlag
// set to false. Doing this does not toggle the value returned by the mateIsUnmapped (it will still return true),
// and ensures that we will subsequently be able to run all the getSAMString tests on these reads once they have
// had a mate position established.
//
// (See the note on setMatePosition in GoogleGenomicsReadToGATKReadAdapter)
final Position matePos = new Position();
matePos.setReverseStrand(false);
googleReadWithUnmappedMate.setNextMatePosition(matePos);
// verify that the read still has mateIsUnmapped == true
Assert.assertTrue(new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate).mateIsUnmapped());
return new Object[][] { { basicReadBackedBySam(), BASIC_READ_MATE_CONTIG, BASIC_READ_MATE_START }, { basicReadBackedByGoogle(), BASIC_READ_MATE_CONTIG, BASIC_READ_MATE_START }, { new SAMRecordToGATKReadAdapter(samWithUnmappedMate), null, ReadConstants.UNSET_POSITION }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate), null, ReadConstants.UNSET_POSITION } };
}
use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.
the class GATKReadAdaptersUnitTest method getAndSetBasesData.
@DataProvider(name = "GetAndSetBasesData")
public Object[][] getAndSetBasesData() {
final SAMRecord baselessSam = basicSAMRecord();
baselessSam.setReadBases(null);
final SAMRecord noAlignedSequenceSam = basicSAMRecord();
noAlignedSequenceSam.setReadBases(SAMRecord.NULL_SEQUENCE);
final Read baselessGoogleRead = basicGoogleGenomicsRead();
baselessGoogleRead.setAlignedSequence(null);
final Read emptyStringSequenceGoogleRead = basicGoogleGenomicsRead();
emptyStringSequenceGoogleRead.setAlignedSequence("");
final Read noAlignedSequenceGoogleRead = basicGoogleGenomicsRead();
noAlignedSequenceGoogleRead.setAlignedSequence(SAMRecord.NULL_SEQUENCE_STRING);
return new Object[][] { { basicReadBackedBySam(), BASIC_READ_BASES, "ACGT" }, { basicReadBackedByGoogle(), BASIC_READ_BASES, "ACGT" }, { new SAMRecordToGATKReadAdapter(baselessSam), new byte[0], "*" }, { new SAMRecordToGATKReadAdapter(noAlignedSequenceSam), new byte[0], "*" }, { new GoogleGenomicsReadToGATKReadAdapter(baselessGoogleRead), new byte[0], "*" }, { new GoogleGenomicsReadToGATKReadAdapter(emptyStringSequenceGoogleRead), new byte[0], "*" }, { new GoogleGenomicsReadToGATKReadAdapter(noAlignedSequenceGoogleRead), new byte[0], "*" } };
}
use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.
the class GATKReadAdaptersUnitTest method invalidMateIsUnmappedData.
@DataProvider(name = "InvalidMateIsUnmappedData")
public Object[][] invalidMateIsUnmappedData() {
SAMRecord unpairedSAM = basicSAMRecord();
unpairedSAM.setReadPairedFlag(false);
Read unpairedGoogleRead = basicGoogleGenomicsRead();
unpairedGoogleRead.setNumberReads(1);
return new Object[][] { { new SAMRecordToGATKReadAdapter(unpairedSAM) }, { new GoogleGenomicsReadToGATKReadAdapter(unpairedGoogleRead) } };
}
use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.
the class GATKReadAdaptersUnitTest method mateIsUnmappedData.
@DataProvider(name = "MateIsUnmappedData")
public Object[][] mateIsUnmappedData() {
SAMRecord samWithUnmappedMate = basicSAMRecord();
samWithUnmappedMate.setMateUnmappedFlag(true);
SAMRecord samWithUnmappedMate2 = basicSAMRecord();
samWithUnmappedMate2.setMateReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
SAMRecord samWithUnmappedMate3 = basicSAMRecord();
samWithUnmappedMate3.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
Read googleReadWithUnmappedMate = basicGoogleGenomicsRead();
// We have to explicitly set the mate reverse strand flag in order to ensure that we can call getSAMString
// on the read once its been wrapped by the adapter; if it hasn't been explicitly set the adapter will
// throw when we query for the flags.
Position newPosition = new Position();
newPosition.setReverseStrand(false);
googleReadWithUnmappedMate.setNextMatePosition(newPosition);
Read googleReadWithUnmappedMate2 = basicGoogleGenomicsRead();
googleReadWithUnmappedMate2.getNextMatePosition().setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
Read googleReadWithUnmappedMate3 = basicGoogleGenomicsRead();
googleReadWithUnmappedMate3.getNextMatePosition().setPosition(-1l);
Read googleReadWithUnmappedMate4 = basicGoogleGenomicsRead();
googleReadWithUnmappedMate4.getNextMatePosition().setReferenceName(null);
Read googleReadWithUnmappedMate5 = basicGoogleGenomicsRead();
googleReadWithUnmappedMate5.getNextMatePosition().setPosition(null);
return new Object[][] { { basicReadBackedBySam(), false }, { basicReadBackedByGoogle(), false }, { new SAMRecordToGATKReadAdapter(samWithUnmappedMate), true }, { new SAMRecordToGATKReadAdapter(samWithUnmappedMate2), true }, { new SAMRecordToGATKReadAdapter(samWithUnmappedMate3), true }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate), true }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate2), true }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate3), true }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate4), true }, { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithUnmappedMate5), true } };
}
Aggregations