use of com.milaboratory.mixcr.partialassembler.AlignedTarget in project mixcr by milaboratory.
the class VDJCAlignerPVFirst method process0.
@Override
protected VDJCAlignmentResult<PairedRead> process0(final PairedRead input) {
Target[] targets = getTargets(input);
// Creates helper classes for each PTarget
PAlignmentHelper[] helpers = createInitialHelpers(targets);
VDJCAlignmentResult<PairedRead> result = parameters.getAllowPartialAlignments() ? processPartial(input, helpers) : processStrict(input, helpers);
// if sAligner == null (which means --no-merge option), no merge will be performed
if (result.alignment != null && sAligner != null) {
final VDJCAlignments alignment = result.alignment;
final TargetMerger.TargetMergingResult mergeResult = alignmentsMerger.merge(new AlignedTarget(alignment, 0), new AlignedTarget(alignment, 1), false);
if (mergeResult.failedDueInconsistentAlignments()) {
GeneType geneType = mergeResult.getFailedMergedGeneType();
int removeId = alignment.getBestHit(geneType).getAlignment(0).getScore() > alignment.getBestHit(geneType).getAlignment(1).getScore() ? 1 : 0;
if (listener != null)
listener.onTopHitSequenceConflict(input, alignment, geneType);
return new VDJCAlignmentResult<>(input, alignment.removeBestHitAlignment(geneType, removeId));
} else if (mergeResult.isSuccessful()) {
assert mergeResult.isUsingAlignments();
NSequenceWithQuality alignedTarget = mergeResult.getResult().getTarget();
SingleRead sRead = new SingleReadImpl(input.getId(), alignedTarget, "");
VDJCAlignmentResult<SingleRead> sResult = sAligner.process0(sRead);
if (sResult.alignment == null)
return result;
VDJCAlignments sAlignment = sResult.alignment.setHistory(new SequenceHistory[] { new SequenceHistory.Merge(SequenceHistory.OverlapType.AlignmentOverlap, result.alignment.getHistory(0), result.alignment.getHistory(1), mergeResult.getOffset(), mergeResult.getMismatched()) }, new SequenceRead[] { input });
if (listener != null)
listener.onSuccessfulAlignmentOverlap(input, sAlignment);
return new VDJCAlignmentResult<>(input, sAlignment);
}
}
return result;
}
Aggregations