Search in sources :

Example 6 with CachingIndexedFastaSequenceFile

use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.

the class ReadUtilsUnitTest method testReadWithNsRefIndexInDeletion.

@Test
public void testReadWithNsRefIndexInDeletion() throws FileNotFoundException {
    final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(exampleReference));
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
    final int readLength = 76;
    final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, 8975, readLength);
    read.setBases(Utils.dupBytes((byte) 'A', readLength));
    read.setBaseQualities(Utils.dupBytes((byte) 30, readLength));
    read.setCigar("3M414N1D73M");
    final int result = ReadUtils.getReadCoordinateForReferenceCoordinateUpToEndOfRead(read, 9392, ReadUtils.ClippingTail.LEFT_TAIL);
    Assert.assertEquals(result, 2);
}
Also used : CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) SAMFileHeader(htsjdk.samtools.SAMFileHeader) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 7 with CachingIndexedFastaSequenceFile

use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.

the class ReadUtilsUnitTest method testReadWithNsRefAfterDeletion.

@Test
public void testReadWithNsRefAfterDeletion() throws FileNotFoundException {
    final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(exampleReference));
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
    final int readLength = 76;
    final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, 8975, readLength);
    read.setBases(Utils.dupBytes((byte) 'A', readLength));
    read.setBaseQualities(Utils.dupBytes((byte) 30, readLength));
    read.setCigar("3M414N1D73M");
    final int result = ReadUtils.getReadCoordinateForReferenceCoordinateUpToEndOfRead(read, 9393, ReadUtils.ClippingTail.LEFT_TAIL);
    Assert.assertEquals(result, 3);
}
Also used : CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) SAMFileHeader(htsjdk.samtools.SAMFileHeader) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 8 with CachingIndexedFastaSequenceFile

use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk-protected by broadinstitute.

the class HaplotypeCaller method getReferenceReader.

private static CachingIndexedFastaSequenceFile getReferenceReader(ReferenceInputArgumentCollection referenceArguments) {
    final CachingIndexedFastaSequenceFile referenceReader;
    final File reference = new File(referenceArguments.getReferenceFileName());
    try {
        referenceReader = new CachingIndexedFastaSequenceFile(reference);
    } catch (FileNotFoundException e) {
        throw new UserException.CouldNotReadInputFile(reference, e);
    }
    return referenceReader;
}
Also used : FileNotFoundException(java.io.FileNotFoundException) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) UserException(org.broadinstitute.hellbender.exceptions.UserException) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) ReferenceSequenceFile(htsjdk.samtools.reference.ReferenceSequenceFile)

Example 9 with CachingIndexedFastaSequenceFile

use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.

the class ActivityProfileUnitTest method init.

@BeforeClass
public void init() throws FileNotFoundException {
    // sequence
    ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37_reference_20_21));
    genomeLocParser = new GenomeLocParser(seq);
    startLoc = genomeLocParser.createGenomeLoc("20", 0, 1, 100);
    header = new SAMFileHeader();
    seq.getSequenceDictionary().getSequences().forEach(sequence -> header.addSequence(sequence));
}
Also used : CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) ReferenceSequenceFile(htsjdk.samtools.reference.ReferenceSequenceFile) SAMFileHeader(htsjdk.samtools.SAMFileHeader) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) ReferenceSequenceFile(htsjdk.samtools.reference.ReferenceSequenceFile) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with CachingIndexedFastaSequenceFile

use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.

the class BandPassActivityProfileUnitTest method init.

@BeforeClass
public void init() throws FileNotFoundException {
    // sequence
    ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37_reference_20_21));
    genomeLocParser = new GenomeLocParser(seq);
    header = new SAMFileHeader();
    seq.getSequenceDictionary().getSequences().forEach(sequence -> header.addSequence(sequence));
}
Also used : CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) ReferenceSequenceFile(htsjdk.samtools.reference.ReferenceSequenceFile) GenomeLocParser(org.broadinstitute.hellbender.utils.GenomeLocParser) SAMFileHeader(htsjdk.samtools.SAMFileHeader) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) ReferenceSequenceFile(htsjdk.samtools.reference.ReferenceSequenceFile) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

CachingIndexedFastaSequenceFile (org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile)15 File (java.io.File)14 BeforeClass (org.testng.annotations.BeforeClass)6 SAMFileHeader (htsjdk.samtools.SAMFileHeader)5 IndexedFastaSequenceFile (htsjdk.samtools.reference.IndexedFastaSequenceFile)5 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)5 Test (org.testng.annotations.Test)5 ReferenceSequenceFile (htsjdk.samtools.reference.ReferenceSequenceFile)4 FileNotFoundException (java.io.FileNotFoundException)3 UserException (org.broadinstitute.hellbender.exceptions.UserException)3 GenomeLocParser (org.broadinstitute.hellbender.utils.GenomeLocParser)3 ReadFilter (org.broadinstitute.hellbender.engine.filters.ReadFilter)2 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)2 ActivityProfileState (org.broadinstitute.hellbender.utils.activityprofile.ActivityProfileState)2 ReadFilteringIterator (org.broadinstitute.hellbender.utils.iterators.ReadFilteringIterator)2 LocusIteratorByState (org.broadinstitute.hellbender.utils.locusiterator.LocusIteratorByState)2 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)2 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)1 SAMSequenceRecord (htsjdk.samtools.SAMSequenceRecord)1 NDNCigarReadTransformer (org.broadinstitute.hellbender.transformers.NDNCigarReadTransformer)1