use of htsjdk.samtools.reference.ReferenceSequenceFile in project gatk by broadinstitute.
the class ActivityProfileUnitTest method init.
@BeforeClass
public void init() throws FileNotFoundException {
// sequence
ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37_reference_20_21));
genomeLocParser = new GenomeLocParser(seq);
startLoc = genomeLocParser.createGenomeLoc("20", 0, 1, 100);
header = new SAMFileHeader();
seq.getSequenceDictionary().getSequences().forEach(sequence -> header.addSequence(sequence));
}
use of htsjdk.samtools.reference.ReferenceSequenceFile in project gatk by broadinstitute.
the class BandPassActivityProfileUnitTest method init.
@BeforeClass
public void init() throws FileNotFoundException {
// sequence
ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37_reference_20_21));
genomeLocParser = new GenomeLocParser(seq);
header = new SAMFileHeader();
seq.getSequenceDictionary().getSequences().forEach(sequence -> header.addSequence(sequence));
}
use of htsjdk.samtools.reference.ReferenceSequenceFile in project gatk-protected by broadinstitute.
the class HaplotypeCaller method onTraversalStart.
@Override
public void onTraversalStart() {
final ReferenceSequenceFile referenceReader = getReferenceReader(referenceArguments);
hcEngine = new HaplotypeCallerEngine(hcArgs, getHeaderForReads(), referenceReader);
// The HC engine will make the right kind (VCF or GVCF) of writer for us
final SAMSequenceDictionary sequenceDictionary = getHeaderForReads().getSequenceDictionary();
vcfWriter = hcEngine.makeVCFWriter(outputVCF, sequenceDictionary);
hcEngine.writeHeader(vcfWriter, sequenceDictionary, getDefaultToolVCFHeaderLines());
}
use of htsjdk.samtools.reference.ReferenceSequenceFile in project gatk by broadinstitute.
the class AssemblyBasedCallerUtils method assembleReads.
/**
* High-level function that runs the assembler on the given region's reads,
* returning a data structure with the resulting information needed
* for further HC steps
*/
public static AssemblyResultSet assembleReads(final AssemblyRegion region, final List<VariantContext> givenAlleles, final AssemblyBasedCallerArgumentCollection argumentCollection, final SAMFileHeader header, final SampleList sampleList, final Logger logger, final ReferenceSequenceFile referenceReader, final ReadThreadingAssembler assemblyEngine) {
finalizeRegion(region, argumentCollection.errorCorrectReads, argumentCollection.dontUseSoftClippedBases, (byte) (argumentCollection.minBaseQualityScore - 1), header, sampleList);
if (argumentCollection.debug) {
logger.info("Assembling " + region.getSpan() + " with " + region.size() + " reads: (with overlap region = " + region.getExtendedSpan() + ")");
}
final byte[] fullReferenceWithPadding = region.getAssemblyRegionReference(referenceReader, REFERENCE_PADDING_FOR_ASSEMBLY);
final SimpleInterval paddedReferenceLoc = getPaddedReferenceLoc(region, REFERENCE_PADDING_FOR_ASSEMBLY, referenceReader);
final Haplotype referenceHaplotype = createReferenceHaplotype(region, paddedReferenceLoc, referenceReader);
final ReadErrorCorrector readErrorCorrector = argumentCollection.errorCorrectReads ? new ReadErrorCorrector(argumentCollection.assemblerArgs.kmerLengthForReadErrorCorrection, HaplotypeCallerEngine.MIN_TAIL_QUALITY_WITH_ERROR_CORRECTION, argumentCollection.assemblerArgs.minObservationsForKmerToBeSolid, argumentCollection.debug, fullReferenceWithPadding) : null;
try {
final AssemblyResultSet assemblyResultSet = assemblyEngine.runLocalAssembly(region, referenceHaplotype, fullReferenceWithPadding, paddedReferenceLoc, givenAlleles, readErrorCorrector, header);
assemblyResultSet.debugDump(logger);
return assemblyResultSet;
} catch (final Exception e) {
// Capture any exception that might be thrown, and write out the assembly failure BAM if requested
if (argumentCollection.captureAssemblyFailureBAM) {
try (final SAMFileWriter writer = ReadUtils.createCommonSAMWriter(new File("assemblyFailure.bam"), null, header, false, false, false)) {
for (final GATKRead read : region.getReads()) {
writer.addAlignment(read.convertToSAMRecord(header));
}
}
}
throw e;
}
}
use of htsjdk.samtools.reference.ReferenceSequenceFile in project gatk by broadinstitute.
the class HaplotypeCaller method onTraversalStart.
@Override
public void onTraversalStart() {
final ReferenceSequenceFile referenceReader = getReferenceReader(referenceArguments);
hcEngine = new HaplotypeCallerEngine(hcArgs, getHeaderForReads(), referenceReader);
// The HC engine will make the right kind (VCF or GVCF) of writer for us
final SAMSequenceDictionary sequenceDictionary = getHeaderForReads().getSequenceDictionary();
vcfWriter = hcEngine.makeVCFWriter(outputVCF, sequenceDictionary);
hcEngine.writeHeader(vcfWriter, sequenceDictionary, getDefaultToolVCFHeaderLines());
}
Aggregations