use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.
the class GenomeLocParserUnitTest method testcreateGenomeLocOnContig.
@Test
public void testcreateGenomeLocOnContig() throws FileNotFoundException {
final CachingIndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(exampleReference));
final SAMSequenceDictionary dict = seq.getSequenceDictionary();
final GenomeLocParser genomeLocParser = new GenomeLocParser(dict);
for (final SAMSequenceRecord rec : dict.getSequences()) {
final GenomeLoc loc = genomeLocParser.createOverEntireContig(rec.getSequenceName());
Assert.assertEquals(loc.getContig(), rec.getSequenceName());
Assert.assertEquals(loc.getStart(), 1);
Assert.assertEquals(loc.getStop(), rec.getSequenceLength());
}
}
use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.
the class GenomeLocSortedSetUnitTest method makeGetOverlappingTest.
// -----------------------------------------------------------------------------------------------
//
// Test getOverlapping
//
// -----------------------------------------------------------------------------------------------
@DataProvider(name = "GetOverlapping")
public Object[][] makeGetOverlappingTest() throws Exception {
final GenomeLocParser genomeLocParser = new GenomeLocParser(new CachingIndexedFastaSequenceFile(new File(exampleReference)));
List<Object[]> tests = new ArrayList<>();
final GenomeLoc prev1 = genomeLocParser.createGenomeLoc("1", 1, 10);
final GenomeLoc prev2 = genomeLocParser.createGenomeLoc("1", 20, 50);
final GenomeLoc post1 = genomeLocParser.createGenomeLoc("3", 1, 10);
final GenomeLoc post2 = genomeLocParser.createGenomeLoc("3", 20, 50);
final int chr20Length = genomeLocParser.getSequenceDictionary().getSequence("2").getSequenceLength();
for (final int regionStart : Arrays.asList(1, 10, chr20Length - 10, chr20Length)) {
for (final int regionSize : Arrays.asList(1, 10, 100)) {
final GenomeLoc region = genomeLocParser.createGenomeLocOnContig("2", regionStart, regionStart + regionSize);
final GenomeLoc spanning = genomeLocParser.createGenomeLocOnContig("2", regionStart - 10, region.getStop() + 10);
final GenomeLoc before_into = genomeLocParser.createGenomeLocOnContig("2", regionStart - 10, regionStart + 1);
final GenomeLoc middle = genomeLocParser.createGenomeLocOnContig("2", regionStart + 1, regionStart + 2);
final GenomeLoc middle_past = genomeLocParser.createGenomeLocOnContig("2", region.getStop() - 1, region.getStop() + 10);
final List<GenomeLoc> potentials = new LinkedList<>();
potentials.add(region);
if (spanning != null)
potentials.add(spanning);
if (before_into != null)
potentials.add(before_into);
if (middle != null)
potentials.add(middle);
if (middle_past != null)
potentials.add(middle_past);
for (final int n : Arrays.asList(1, 2, 3)) {
for (final List<GenomeLoc> regions : Utils.makePermutations(potentials, n, false)) {
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, regions), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, prev1)), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, prev1, prev2)), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, post1)), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, post1, post2)), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, prev1, post1)), region });
tests.add(new Object[] { new GenomeLocSortedSet(genomeLocParser, Utils.append(regions, prev1, prev2, post1, post2)), region });
}
}
}
}
return tests.toArray(new Object[][] {});
}
use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.
the class ReadThreadingAssemblerUnitTest method setup.
@BeforeClass
public void setup() throws FileNotFoundException {
seq = new CachingIndexedFastaSequenceFile(new File(hg19_chr1_1M_Reference));
header = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
}
use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk by broadinstitute.
the class SplitNCigarReads method onTraversalStart.
@Override
public void onTraversalStart() {
header = getHeaderForSAMWriter();
rnaReadTransform = REFACTOR_NDN_CIGAR_READS ? new NDNCigarReadTransformer() : ReadTransformer.identity();
try {
referenceReader = new CachingIndexedFastaSequenceFile(referenceArguments.getReferenceFile());
GenomeLocParser genomeLocParser = new GenomeLocParser(getBestAvailableSequenceDictionary());
outputWriter = createSAMWriter(OUTPUT, false);
overhangManager = new OverhangFixingManager(header, outputWriter, genomeLocParser, referenceReader, MAX_RECORDS_IN_MEMORY, MAX_MISMATCHES_IN_OVERHANG, MAX_BASES_TO_CLIP, doNotFixOverhangs, processSecondaryAlignments);
} catch (FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceArguments.getReferenceFile(), ex);
}
}
use of org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile in project gatk-protected by broadinstitute.
the class ReadThreadingAssemblerUnitTest method setup.
@BeforeClass
public void setup() throws FileNotFoundException {
seq = new CachingIndexedFastaSequenceFile(new File(hg19_chr1_1M_Reference));
header = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
}
Aggregations