use of htsjdk.tribble.SimpleFeature in project gatk by broadinstitute.
the class IntervalUtilsUnitTest method lexicographicalOrderComparatorData.
@DataProvider(name = "lexicographicalOrderComparatorData")
public Object[][] lexicographicalOrderComparatorData() {
final String[] CONTIG_NAMES = new String[] { "A", "AA", "B", "C", null };
final int[] CONTIG_SIZES = new int[] { 200, 300, 400, 500, 600 };
final int MIN_INTERVAL_SIZE = 1;
final int MAX_INTERVAL_SIZE = 100;
final Random rdn = new Random(1131312131);
final int CASE_NUMBER = 100;
final List<Object[]> result = new ArrayList<>(100);
for (int i = 0; i < CASE_NUMBER; i++) {
final int locatableCount = rdn.nextInt(100) + 1;
final List<Locatable> locatables = new ArrayList<>(locatableCount);
for (int j = 0; j < locatableCount; j++) {
final int contigIdx = rdn.nextInt(CONTIG_NAMES.length);
final String contig = CONTIG_NAMES[contigIdx];
final boolean useSimpleInterval = contig == null ? false : rdn.nextBoolean();
final int intervalSize = rdn.nextInt(MAX_INTERVAL_SIZE - MIN_INTERVAL_SIZE + 1) + MIN_INTERVAL_SIZE;
final int start = rdn.nextInt(CONTIG_SIZES[contigIdx] - intervalSize) + 1;
final int end = start + intervalSize - 1;
final Locatable loc = useSimpleInterval ? new SimpleInterval(contig, start, end) : new SimpleFeature(contig, start, end);
locatables.add(loc);
}
result.add(new Object[] { locatables });
}
return result.toArray(new Object[result.size()][]);
}
use of htsjdk.tribble.SimpleFeature in project gatk by broadinstitute.
the class GenomeLocParserUnitTest method testCreationFromFeature.
@Test
public void testCreationFromFeature() {
final Feature feature = new SimpleFeature("1", 1, 5);
final GenomeLoc loc = genomeLocParser.createGenomeLoc(feature);
Assert.assertEquals(loc.getContig(), feature.getContig());
Assert.assertEquals(loc.getStart(), feature.getStart());
Assert.assertEquals(loc.getStop(), feature.getEnd());
}
Aggregations