use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class SequenceDictionaryUtilsUnitTest method testStandardValidationIgnoresContigOrder.
@Test(dataProvider = "StandardValidationIgnoresContigOrderData")
public void testStandardValidationIgnoresContigOrder(final List<SAMSequenceRecord> firstDictionaryContigs, final List<SAMSequenceRecord> secondDictionaryContigs) {
final SAMSequenceDictionary firstDictionary = createSequenceDictionary(firstDictionaryContigs);
final SAMSequenceDictionary secondDictionary = createSequenceDictionary(secondDictionaryContigs);
// Standard validation (the overload of validateDictionaries() that doesn't take any boolean args)
// should ignore differences in ordering of common contigs, so we shouldn't get an exception here
SequenceDictionaryUtils.validateDictionaries("first", firstDictionary, "second", secondDictionary);
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class SimpleIntervalUnitTest method expandWithinContigInvalidTestData.
@DataProvider(name = "ExpandWithinContigInvalidData")
public Object[][] expandWithinContigInvalidTestData() {
final int CONTIG_LENGTH = 10000;
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(new SAMSequenceRecord("1", CONTIG_LENGTH)));
final SAMSequenceDictionary badDictionary = new SAMSequenceDictionary(Arrays.asList(new SAMSequenceRecord("2", CONTIG_LENGTH)));
return new Object[][] { { new SimpleInterval("1", 1, 10), -1, CONTIG_LENGTH, dictionary }, { new SimpleInterval("1", 1, 10), 1, 0, dictionary }, { new SimpleInterval("1", 1, 10), 1, -1, dictionary }, { new SimpleInterval("1", 1, 10), 1, CONTIG_LENGTH, null }, { new SimpleInterval("1", 1, 10), 1, CONTIG_LENGTH, badDictionary } };
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testParseIntervalWithPeriodInContigName.
@Test
public void testParseIntervalWithPeriodInContigName() {
// Make sure that we don't interpret contigs with periods in their name as files
final String contigName = "GL000249.1";
final SAMSequenceRecord contigRecord = new SAMSequenceRecord(contigName, 100);
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(contigRecord));
final GenomeLocParser parser = new GenomeLocParser(dictionary);
final List<GenomeLoc> result = IntervalUtils.parseIntervalArguments(parser, contigName);
Assert.assertEquals(result.size(), 1);
Assert.assertEquals(result.get(0).getContig(), contigName);
Assert.assertEquals(result.get(0).getStart(), 1);
Assert.assertEquals(result.get(0).getEnd(), 100);
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method testConvertSimpleIntervalToQueryInterval.
@Test
public void testConvertSimpleIntervalToQueryInterval() {
final SAMSequenceRecord contigRecord = new SAMSequenceRecord("1", 100);
final SAMSequenceDictionary dictionary = new SAMSequenceDictionary(Arrays.asList(contigRecord));
final SimpleInterval originalInterval = new SimpleInterval("1", 5, 10);
final QueryInterval convertedInterval = IntervalUtils.convertSimpleIntervalToQueryInterval(originalInterval, dictionary);
Assert.assertEquals(convertedInterval.referenceIndex, 0);
Assert.assertEquals(convertedInterval.start, 5);
Assert.assertEquals(convertedInterval.end, 10);
}
use of htsjdk.samtools.SAMSequenceDictionary in project gatk by broadinstitute.
the class ReferenceUtilsUnitTest method testLoadFastaDictionaryFromFile.
@Test
public void testLoadFastaDictionaryFromFile() {
final File referenceDictionaryFile = new File(ReferenceUtils.getFastaDictionaryFileName(hg19MiniReference));
final SAMSequenceDictionary dictionary = ReferenceUtils.loadFastaDictionary(referenceDictionaryFile);
Assert.assertNotNull(dictionary, "Sequence dictionary null after loading");
Assert.assertEquals(dictionary.size(), 4, "Wrong sequence dictionary size after loading");
}
Aggregations