use of org.broadinstitute.hellbender.engine.AssemblyRegion in project gatk by broadinstitute.
the class AssemblyResultSetUnitTest method testTrimTo.
@Test(dataProvider = "trimmingData")
public void testTrimTo(final Map<Haplotype, AssemblyResult> haplotypesAndResultSets, final AssemblyRegion original) {
final AssemblyResultSet subject = new AssemblyResultSet();
for (final Map.Entry<Haplotype, AssemblyResult> entry : haplotypesAndResultSets.entrySet()) subject.add(entry.getKey(), entry.getValue());
subject.setRegionForGenotyping(original);
final SimpleInterval originalLocation = original.getExtendedSpan();
final int length = originalLocation.size();
final SimpleInterval newLocation = new SimpleInterval(originalLocation.getContig(), originalLocation.getStart() + length / 2, originalLocation.getEnd() - length / 2);
final AssemblyRegion newRegion = original.trim(newLocation);
final Map<Haplotype, Haplotype> originalHaplotypesByTrimmed = new HashMap<>(haplotypesAndResultSets.size());
for (final Haplotype h : haplotypesAndResultSets.keySet()) originalHaplotypesByTrimmed.put(h.trim(newRegion.getExtendedSpan()), h);
final AssemblyResultSet trimmed = subject.trimTo(newRegion);
Assert.assertFalse(subject.wasTrimmed());
Assert.assertTrue(trimmed.wasTrimmed());
for (final Haplotype h : trimmed.getHaplotypeList()) {
Assert.assertEquals(h.getGenomeLocation(), newLocation);
Assert.assertEquals(h.getBases().length, newLocation.size());
}
}
use of org.broadinstitute.hellbender.engine.AssemblyRegion in project gatk by broadinstitute.
the class ReadThreadingAssemblerUnitTest method assemble.
private List<Haplotype> assemble(final ReadThreadingAssembler assembler, final byte[] refBases, final SimpleInterval loc, final List<GATKRead> reads) {
final Haplotype refHaplotype = new Haplotype(refBases, true);
final Cigar c = new Cigar();
c.add(new CigarElement(refHaplotype.getBases().length, CigarOperator.M));
refHaplotype.setCigar(c);
final AssemblyRegion activeRegion = new AssemblyRegion(loc, null, true, 0, header);
activeRegion.addAll(reads);
// logger.warn("Assembling " + activeRegion + " with " + engine);
final AssemblyResultSet assemblyResultSet = assembler.runLocalAssembly(activeRegion, refHaplotype, refBases, loc, Collections.<VariantContext>emptyList(), null, header);
return assemblyResultSet.getHaplotypeList();
}
use of org.broadinstitute.hellbender.engine.AssemblyRegion in project gatk-protected by broadinstitute.
the class AssemblyBasedCallerUtils method assemblyRegionWithWellMappedReads.
// create the assembly using just high quality reads (eg Q20 or higher). We may want to use lower
// quality reads in the PairHMM downstream, so we can't use a ReadFilter
public static AssemblyRegion assemblyRegionWithWellMappedReads(final AssemblyRegion originalAssemblyRegion, final int minMappingQuality, final SAMFileHeader readsHeader) {
final AssemblyRegion result = new AssemblyRegion(originalAssemblyRegion.getSpan(), originalAssemblyRegion.getSupportingStates(), originalAssemblyRegion.isActive(), originalAssemblyRegion.getExtension(), readsHeader);
originalAssemblyRegion.getReads().stream().filter(rec -> rec.getMappingQuality() >= minMappingQuality).forEach(result::add);
return result;
}
Aggregations