Search in sources :

Example 96 with SAMFileHeader

use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.

the class SATagBuilderUnitTests method testEmptyNMTagSupport.

@Test
public void testEmptyNMTagSupport() {
    SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader();
    GATKRead read = ArtificialReadUtils.createArtificialRead(header, "name", "2", 1, "AAAAAAAAAA".getBytes(), "##########".getBytes());
    read.setAttribute("SA", "1,191,-,8M2S,60,*;");
    List<GATKRead> reads = (new SATagBuilder(read)).getArtificialReadsBasedOnSATag(header);
    Assert.assertFalse(reads.get(0).hasAttribute("NM"));
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) SAMFileHeader(htsjdk.samtools.SAMFileHeader) Test(org.testng.annotations.Test)

Example 97 with SAMFileHeader

use of htsjdk.samtools.SAMFileHeader 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 98 with SAMFileHeader

use of htsjdk.samtools.SAMFileHeader 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)

Example 99 with SAMFileHeader

use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.

the class ReadClipperUnitTest method testSoftClippingOpEdgeCase.

// This test depends on issue #2022 as it tests the current behavior of the clipping operation
@Test
public void testSoftClippingOpEdgeCase() {
    final SAMFileHeader header = new SAMFileHeader();
    header.setSequenceDictionary(hg19GenomeLocParser.getSequenceDictionary());
    GATKRead read = ReadClipperTestUtils.makeReadFromCigar("8M");
    ReadClipper clipper = new ReadClipper(read);
    ClippingOp op = new ClippingOp(0, 7);
    clipper.addOp(op);
    GATKRead softResult = clipper.clipRead(ClippingRepresentation.SOFTCLIP_BASES);
    Assert.assertEquals(softResult.getCigar().toString(), "7S1M");
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) SAMFileHeader(htsjdk.samtools.SAMFileHeader) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) SplitNCigarReadsUnitTest(org.broadinstitute.hellbender.tools.walkers.rnaseq.SplitNCigarReadsUnitTest)

Example 100 with SAMFileHeader

use of htsjdk.samtools.SAMFileHeader in project gatk by broadinstitute.

the class ActivityProfileStateUnitTest method init.

@BeforeClass
public void init() {
    // sequence
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 100);
    sequenceDictionary = header.getSequenceDictionary();
}
Also used : SAMFileHeader(htsjdk.samtools.SAMFileHeader) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

SAMFileHeader (htsjdk.samtools.SAMFileHeader)148 Test (org.testng.annotations.Test)89 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)85 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)71 File (java.io.File)23 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)22 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)17 DataProvider (org.testng.annotations.DataProvider)17 java.util (java.util)15 UserException (org.broadinstitute.hellbender.exceptions.UserException)15 ArrayList (java.util.ArrayList)14 List (java.util.List)12 Collectors (java.util.stream.Collectors)12 JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)12 SAMRecord (htsjdk.samtools.SAMRecord)11 Locatable (htsjdk.samtools.util.Locatable)11 BeforeClass (org.testng.annotations.BeforeClass)11 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)10 SAMSequenceRecord (htsjdk.samtools.SAMSequenceRecord)10 ReadPileup (org.broadinstitute.hellbender.utils.pileup.ReadPileup)10