use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IndexUtilsUnitTest method testIsSequenceDictionaryFromIndexNegative.
@Test
public void testIsSequenceDictionaryFromIndexNegative() throws Exception {
SAMSequenceDictionary dict = new SAMSequenceDictionary();
dict.addSequence(new SAMSequenceRecord("1", 99));
dict.addSequence(new SAMSequenceRecord("2", 99));
Assert.assertFalse(IndexUtils.isSequenceDictionaryFromIndex(dict));
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testParseUnmappedIntervalArgument.
@Test
public void testParseUnmappedIntervalArgument() {
final SAMSequenceRecord contigRecord = new SAMSequenceRecord("1", 100);
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(contigRecord));
final GenomeLocParser parser = new GenomeLocParser(dictionary);
List<GenomeLoc> unmappedLoc = IntervalUtils.parseIntervalArguments(parser, "unmapped");
Assert.assertTrue(unmappedLoc.size() == 1);
Assert.assertTrue(unmappedLoc.get(0).isUnmapped());
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testParseUnmappedIntervalArgumentInIntervalFile.
@Test
public void testParseUnmappedIntervalArgumentInIntervalFile() {
final SAMSequenceRecord contigRecord = new SAMSequenceRecord("1", 100);
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(contigRecord));
final GenomeLocParser parser = new GenomeLocParser(dictionary);
List<GenomeLoc> unmappedLoc = IntervalUtils.parseIntervalArguments(parser, publicTestDir + "org/broadinstitute/hellbender/engine/reads_data_source_test1_unmapped.intervals");
Assert.assertTrue(unmappedLoc.size() == 1);
Assert.assertTrue(unmappedLoc.get(0).isUnmapped());
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testCompareLocatables.
@Test
public void testCompareLocatables() throws Exception {
final SAMSequenceDictionary dict = new SAMSequenceDictionary();
dict.addSequence(new SAMSequenceRecord("1", 1000));
dict.addSequence(new SAMSequenceRecord("2", 1000));
final SimpleInterval chr1_1_100 = new SimpleInterval("1:1-100");
final SimpleInterval chr1_5_100 = new SimpleInterval("1:5-100");
final SimpleInterval chr2_1_100 = new SimpleInterval("2:1-100");
// equal intervals comparison return 0
Assert.assertEquals(IntervalUtils.compareLocatables(chr1_1_100, chr1_1_100, dict), 0);
Assert.assertEquals(IntervalUtils.compareLocatables(chr1_5_100, chr1_5_100, dict), 0);
Assert.assertEquals(IntervalUtils.compareLocatables(chr2_1_100, chr2_1_100, dict), 0);
// first < second return negative
Assert.assertTrue(IntervalUtils.compareLocatables(chr1_1_100, chr1_5_100, dict) < 0);
Assert.assertTrue(IntervalUtils.compareLocatables(chr1_1_100, chr2_1_100, dict) < 0);
Assert.assertTrue(IntervalUtils.compareLocatables(chr1_5_100, chr2_1_100, dict) < 0);
// first > second return positive
Assert.assertTrue(IntervalUtils.compareLocatables(chr2_1_100, chr1_1_100, dict) > 0);
Assert.assertTrue(IntervalUtils.compareLocatables(chr2_1_100, chr1_5_100, dict) > 0);
Assert.assertTrue(IntervalUtils.compareLocatables(chr1_5_100, chr1_1_100, dict) > 0);
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testIntervalIsOnDictionaryContigNullInterval.
@Test(expectedExceptions = IllegalArgumentException.class)
public void testIntervalIsOnDictionaryContigNullInterval() {
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(new SAMSequenceRecord("1", 1000)));
IntervalUtils.intervalIsOnDictionaryContig(null, dictionary);
}
Aggregations