use of au.edu.wehi.idsv.visualisation.PositionalDeBruijnGraphTracker in project gridss by PapenfussLab.
the class PositionalAssembler method createAssembler.
private NonReferenceContigAssembler createAssembler() {
AssemblyConfiguration ap = context.getAssemblyParameters();
int maxKmerSupportIntervalWidth = source.getMaxConcordantFragmentSize() - source.getMinConcordantFragmentSize() + 1;
int maxReadLength = source.getMaxReadLength();
int k = ap.k;
int maxEvidenceSupportIntervalWidth = maxKmerSupportIntervalWidth + maxReadLength - k + 2;
int maxPathLength = ap.positional.maxPathLengthInBases(maxReadLength);
int maxPathCollapseLength = ap.errorCorrection.maxPathCollapseLengthInBases(maxReadLength);
int anchorAssemblyLength = ap.anchorLength;
int referenceIndex = it.peek().getBreakendSummary().referenceIndex;
int firstPosition = it.peek().getBreakendSummary().start;
currentContig = context.getDictionary().getSequence(referenceIndex).getSequenceName();
ReferenceIndexIterator evidenceIt = new ReferenceIndexIterator(it, referenceIndex);
EvidenceTracker evidenceTracker = new EvidenceTracker();
SupportNodeIterator supportIt = new SupportNodeIterator(k, evidenceIt, source.getMaxConcordantFragmentSize(), evidenceTracker, ap.includePairAnchors, ap.pairAnchorMismatchIgnoreEndBases);
AggregateNodeIterator agIt = new AggregateNodeIterator(supportIt);
Iterator<KmerNode> knIt = agIt;
if (Defaults.SANITY_CHECK_DE_BRUIJN) {
knIt = evidenceTracker.new AggregateNodeAssertionInterceptor(knIt);
}
PathNodeIterator pathNodeIt = new PathNodeIterator(knIt, maxPathLength, k);
Iterator<KmerPathNode> pnIt = pathNodeIt;
if (Defaults.SANITY_CHECK_DE_BRUIJN) {
pnIt = evidenceTracker.new PathNodeAssertionInterceptor(pnIt, "PathNodeIterator");
}
CollapseIterator collapseIt = null;
PathSimplificationIterator simplifyIt = null;
if (ap.errorCorrection.maxBaseMismatchForCollapse > 0) {
if (!ap.errorCorrection.collapseBubblesOnly) {
log.warn("Collapsing all paths is an exponential time operation. Gridss is likely to hang if your genome contains repetative sequence");
collapseIt = new PathCollapseIterator(pnIt, k, maxPathCollapseLength, ap.errorCorrection.maxBaseMismatchForCollapse, false, 0);
} else {
collapseIt = new LeafBubbleCollapseIterator(pnIt, k, maxPathCollapseLength, ap.errorCorrection.maxBaseMismatchForCollapse);
}
pnIt = collapseIt;
if (Defaults.SANITY_CHECK_DE_BRUIJN) {
pnIt = evidenceTracker.new PathNodeAssertionInterceptor(pnIt, "PathCollapseIterator");
}
simplifyIt = new PathSimplificationIterator(pnIt, maxPathLength, maxKmerSupportIntervalWidth);
pnIt = simplifyIt;
if (Defaults.SANITY_CHECK_DE_BRUIJN) {
pnIt = evidenceTracker.new PathNodeAssertionInterceptor(pnIt, "PathSimplificationIterator");
}
}
currentAssembler = new NonReferenceContigAssembler(pnIt, referenceIndex, maxEvidenceSupportIntervalWidth, anchorAssemblyLength, k, source, assemblyNameGenerator, evidenceTracker, currentContig);
VisualisationConfiguration vis = context.getConfig().getVisualisation();
if (vis.assemblyProgress) {
String filename = String.format("positional-%s_%d-%s.csv", context.getDictionary().getSequence(referenceIndex).getSequenceName(), firstPosition, direction);
File file = new File(vis.directory, filename);
PositionalDeBruijnGraphTracker exportTracker;
try {
exportTracker = new PositionalDeBruijnGraphTracker(file, supportIt, agIt, pathNodeIt, collapseIt, simplifyIt, evidenceTracker, currentAssembler);
exportTracker.writeHeader();
currentAssembler.setExportTracker(exportTracker);
} catch (IOException e) {
log.debug(e);
}
}
currentAssembler.setTelemetry(getTelemetry());
return currentAssembler;
}
Aggregations