Search in sources :

Example 6 with Read

use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.

the class GATKReadAdaptersUnitTest method isPairedData.

@DataProvider(name = "IsPairedData")
public Object[][] isPairedData() {
    SAMRecord unpairedSAM = basicSAMRecord();
    unpairedSAM.setReadPairedFlag(false);
    Read unpairedGoogleRead = basicGoogleGenomicsRead();
    unpairedGoogleRead.setNumberReads(1);
    SAMRecord properlyPairedSAM = basicSAMRecord();
    properlyPairedSAM.setProperPairFlag(true);
    Read properlyPairedGoogleRead = basicGoogleGenomicsRead();
    properlyPairedGoogleRead.setProperPlacement(true);
    SAMRecord unpairedProperlyPairedSAM = basicSAMRecord();
    unpairedProperlyPairedSAM.setReadPairedFlag(false);
    unpairedProperlyPairedSAM.setProperPairFlag(true);
    Read unpairedProperlyPairedGoogleRead = basicGoogleGenomicsRead();
    unpairedProperlyPairedGoogleRead.setNumberReads(1);
    unpairedProperlyPairedGoogleRead.setProperPlacement(true);
    return new Object[][] { { basicReadBackedBySam(), true, false }, { basicReadBackedByGoogle(), true, false }, { new SAMRecordToGATKReadAdapter(unpairedSAM), false, false }, { new GoogleGenomicsReadToGATKReadAdapter(unpairedGoogleRead), false, false }, { new SAMRecordToGATKReadAdapter(properlyPairedSAM), true, true }, { new GoogleGenomicsReadToGATKReadAdapter(properlyPairedGoogleRead), true, true }, // We only consider reads to be properly paired if they are also marked as paired
    { new SAMRecordToGATKReadAdapter(unpairedProperlyPairedSAM), false, false }, { new GoogleGenomicsReadToGATKReadAdapter(unpairedProperlyPairedGoogleRead), false, false } };
}
Also used : Read(com.google.api.services.genomics.model.Read) DataProvider(org.testng.annotations.DataProvider)

Example 7 with Read

use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.

the class GATKReadAdaptersUnitTest method getAndSetReadGroupData.

@DataProvider(name = "GetAndSetReadGroupData")
public Object[][] getAndSetReadGroupData() {
    SAMRecord noRGSam = basicSAMRecord();
    noRGSam.clearAttributes();
    Read noRGGoogleRead = basicGoogleGenomicsRead();
    noRGGoogleRead.setReadGroupId(null);
    return new Object[][] { { basicReadBackedBySam(), BASIC_READ_GROUP }, { basicReadBackedByGoogle(), BASIC_READ_GROUP }, { new SAMRecordToGATKReadAdapter(noRGSam), null }, { new GoogleGenomicsReadToGATKReadAdapter(noRGGoogleRead), null } };
}
Also used : Read(com.google.api.services.genomics.model.Read) DataProvider(org.testng.annotations.DataProvider)

Example 8 with Read

use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.

the class GATKReadAdaptersUnitTest method getLengthData.

@DataProvider(name = "GetLengthData")
public Object[][] getLengthData() {
    final SAMRecord baselessSam = basicSAMRecord();
    baselessSam.setReadBases(SAMRecord.NULL_SEQUENCE);
    final Read baselessGoogleRead = basicGoogleGenomicsRead();
    baselessGoogleRead.setAlignedSequence(null);
    return new Object[][] { { basicReadBackedBySam(), BASIC_READ_BASES.length }, { basicReadBackedByGoogle(), BASIC_READ_BASES.length }, { new SAMRecordToGATKReadAdapter(baselessSam), 0 }, { new GoogleGenomicsReadToGATKReadAdapter(baselessGoogleRead), 0 } };
}
Also used : Read(com.google.api.services.genomics.model.Read) DataProvider(org.testng.annotations.DataProvider)

Example 9 with Read

use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.

the class GATKReadAdaptersUnitTest method getUnmappedReads.

private static List<GATKRead> getUnmappedReads() {
    List<GATKRead> unmappedReads = new ArrayList<>();
    final SAMRecord unmappedFlagSam = basicSAMRecord();
    unmappedFlagSam.setReadUnmappedFlag(true);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(unmappedFlagSam));
    final SAMRecord unmappedContigSam = basicSAMRecord();
    unmappedContigSam.setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(unmappedContigSam));
    final SAMRecord noAlignmentStartSam = basicSAMRecord();
    noAlignmentStartSam.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(noAlignmentStartSam));
    final Read noAlignmentGoogleRead = basicGoogleGenomicsRead();
    noAlignmentGoogleRead.setAlignment(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noAlignmentGoogleRead));
    final Read noPositionGoogleRead = basicGoogleGenomicsRead();
    noPositionGoogleRead.getAlignment().setPosition(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noPositionGoogleRead));
    final Read noContigGoogleRead = basicGoogleGenomicsRead();
    noContigGoogleRead.getAlignment().getPosition().setReferenceName(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noContigGoogleRead));
    final Read starContigGoogleRead = basicGoogleGenomicsRead();
    starContigGoogleRead.getAlignment().getPosition().setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(starContigGoogleRead));
    final Read noStartGoogleRead = basicGoogleGenomicsRead();
    noStartGoogleRead.getAlignment().getPosition().setPosition(-1l);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noStartGoogleRead));
    return unmappedReads;
}
Also used : Read(com.google.api.services.genomics.model.Read)

Example 10 with Read

use of com.google.api.services.genomics.model.Read in project gatk by broadinstitute.

the class GATKReadAdaptersUnitTest method basicGoogleGenomicsRead.

/**
     * Creates a basic mapped Google read with a mapped mate.
     * @return GoogleGenomicsRead
     */
private static Read basicGoogleGenomicsRead() {
    final Read read = ArtificialReadUtils.createArtificialGoogleGenomicsRead(BASIC_READ_NAME, BASIC_READ_CONTIG, BASIC_READ_START, BASIC_READ_BASES, BASIC_READ_BASE_QUALITIES, BASIC_READ_CIGAR);
    read.setReadGroupId(BASIC_READ_GROUP);
    read.getAlignment().getPosition().setReverseStrand(false);
    read.getAlignment().setMappingQuality(BASIC_READ_MAPPING_QUALITY);
    read.setNextMatePosition(new Position());
    read.getNextMatePosition().setReferenceName(BASIC_READ_MATE_CONTIG);
    read.getNextMatePosition().setPosition((long) BASIC_READ_MATE_START - 1);
    read.getNextMatePosition().setReverseStrand(false);
    read.setNumberReads(2);
    read.setReadNumber(0);
    read.setProperPlacement(false);
    Map<String, List<Object>> infoMap = new LinkedHashMap<>();
    infoMap.put(SAMTag.PG.name(), Collections.singletonList(BASIC_PROGRAM));
    read.setInfo(infoMap);
    return read;
}
Also used : Read(com.google.api.services.genomics.model.Read) Position(com.google.api.services.genomics.model.Position)

Aggregations

Read (com.google.api.services.genomics.model.Read)25 DataProvider (org.testng.annotations.DataProvider)20 Position (com.google.api.services.genomics.model.Position)5 LinearAlignment (com.google.api.services.genomics.model.LinearAlignment)2 UnmodifiableCollectionsSerializer (de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer)1 SAMFileHeader (htsjdk.samtools.SAMFileHeader)1 SAMRecord (htsjdk.samtools.SAMRecord)1 PairedEnds (org.broadinstitute.hellbender.utils.read.markduplicates.PairedEnds)1