use of au.edu.wehi.idsv.SequentialIdGenerator in project gridss by PapenfussLab.
the class NonReferenceContigAssemblerTest method create.
private NonReferenceContigAssembler create(ProcessingContext pc, boolean collapse, DirectedEvidence... input) {
Arrays.sort(input, DirectedEvidence.ByStartEnd);
AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, Arrays.stream(input).map(e -> (SAMEvidenceSource) e.getEvidenceSource()).collect(Collectors.toList()), new File("NonReferenceContigAssemblerTest.bam"));
int maxEvidenceWidth = aes.getMaxConcordantFragmentSize() - aes.getMinConcordantFragmentSize() + 1;
int maxReadLength = maxReadLength(input);
int k = pc.getAssemblyParameters().k;
int maxPathLength = pc.getAssemblyParameters().positional.maxPathLengthInBases(maxReadLength);
int maxPathCollapseLength = pc.getAssemblyParameters().errorCorrection.maxPathCollapseLengthInBases(maxReadLength);
tracker = new EvidenceTracker();
SupportNodeIterator supportIt = new SupportNodeIterator(k, Arrays.stream(input).iterator(), aes.getMaxConcordantFragmentSize(), tracker, pc.getAssemblyParameters().includePairAnchors, pc.getAssemblyParameters().pairAnchorMismatchIgnoreEndBases);
AggregateNodeIterator agIt = new AggregateNodeIterator(supportIt);
Iterator<KmerPathNode> pnIt = new PathNodeIterator(agIt, maxPathLength, k);
if (collapse) {
pnIt = new PathCollapseIterator(pnIt, k, maxPathCollapseLength, pc.getAssemblyParameters().errorCorrection.maxBaseMismatchForCollapse, pc.getAssemblyParameters().errorCorrection.collapseBubblesOnly, 0);
pnIt = new PathSimplificationIterator(pnIt, maxPathLength, maxEvidenceWidth);
}
caller = new NonReferenceContigAssembler(pnIt, 0, maxEvidenceWidth + maxReadLength + 2, maxReadLength, k, aes, new SequentialIdGenerator("asm"), tracker, "test");
return caller;
}
use of au.edu.wehi.idsv.SequentialIdGenerator in project gridss by PapenfussLab.
the class PositionalAssemblerTest method should_assemble_simple_forward_soft_clips.
@Test
public void should_assemble_simple_forward_soft_clips() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().anchorLength = 1;
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
// 12345678901234567890
// ACGTTGGTTA
// MMMMMSSSSS
// GCAACGTTGGTTAA
// MMMMMMMMSSSSSS
input.add(SCE(FWD, withSequence("ACGTTGGTTA", Read(0, 10, "5M5S"))[0]));
input.add(SCE(FWD, withSequence("TTTTTGCAACGTTGGTTAA", Read(0, 2, "13M6S"))[0]));
input.sort(DirectedEvidenceOrder.ByStartEnd);
List<SingleReadEvidence> r = asAssemblyEvidence(aes, Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator())));
assertEquals(1, r.size());
assertEquals(new BreakendSummary(0, FWD, 14), r.get(0).getBreakendSummary());
// anchor length to match breakend length
assertEquals("AACGTT", S(r.get(0).getAnchorSequence()));
assertEquals("GGTTAA", S(r.get(0).getBreakendSequence()));
assertEquals("AACGTTGGTTAA", S(r.get(0).getSAMRecord().getReadBases()));
}
use of au.edu.wehi.idsv.SequentialIdGenerator in project gridss by PapenfussLab.
the class PositionalAssemblerTest method should_assemble_simple_input.
@Test
public void should_assemble_simple_input() {
ProcessingContext pc = getContext();
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
input.add(SCE(BWD, Read(0, 10, "5S5M")));
input.add(SCE(FWD, Read(0, 10, "5M5S")));
input.add(SCE(BWD, Read(0, 100, "5S5M")));
input.add(SCE(FWD, Read(0, 100, "5M5S")));
input.sort(DirectedEvidenceOrder.ByStartEnd);
ArrayList<SAMRecord> r = Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator()));
assertEquals(4, r.size());
}
use of au.edu.wehi.idsv.SequentialIdGenerator in project gridss by PapenfussLab.
the class PositionalAssemblerTest method rp_anchor_should_set_non_reference_bases_as_anchoring.
@Test
public void rp_anchor_should_set_non_reference_bases_as_anchoring() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().anchorLength = 1;
AssemblyEvidenceSource aes = AES(pc);
pc.getAssemblyParameters().k = 4;
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
// 12345678901234567890
// ACGTTGGTTA
// MMMMMSSSSS
// GCAACGTTGGTTAA
// MMMMMMMMSSSSSS
// TTTTTGCAACGTTGGTTAA
input.add(SCE(FWD, withSequence("ACGTTGGTTA", Read(0, 10, "5M5S"))[0]));
input.add(SCE(FWD, withSequence("TTTTTGCAACGTTGGTTAA", Read(0, 2, "13M6S"))[0]));
input.add(NRRP(withSequence("TTTTTGCAACGTTGGTTAA", DP(0, 2, "13M6S", true, 1, 1, "19M", false))));
input.sort(DirectedEvidenceOrder.ByStartEnd);
List<SingleReadEvidence> r = asAssemblyEvidence(aes, Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator())));
assertEquals(2, r.size());
// race condition w.r.t which assembly returns first
assertEquals(new BreakendSummary(0, FWD, 14), r.get(0).getBreakendSummary());
// anchor length to match breakend length
assertEquals("AACGTT", S(r.get(0).getAnchorSequence()));
assertEquals("GGTTAA", S(r.get(0).getBreakendSequence()));
assertEquals("AACGTTGGTTAA", S(r.get(0).getSAMRecord().getReadBases()));
}
use of au.edu.wehi.idsv.SequentialIdGenerator in project gridss by PapenfussLab.
the class PositionalAssemblerTest method should_set_assembly_direction.
@Test
public void should_set_assembly_direction() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().k = 4;
pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 10;
List<DirectedEvidence> e = new ArrayList<>();
// ACGTACGTACGTACGTACGT
// 12345678901234567890
// MMMM----MMMM
// MMMM>>>>
e.add(SCE(FWD, withSequence("ACGTCCGGACGG", Read(1, 1, "4M8S"))[0]));
e.add(SCE(FWD, withSequence("ACGGTTGT", Read(1, 9, "4M4S"))[0]));
e.sort(DirectedEvidenceOrder.ByStartEnd);
ArrayList<SAMRecord> output = Lists.newArrayList(new PositionalAssembler(pc, AES(pc), new SequentialIdGenerator("asm"), e.iterator(), BreakendDirection.Forward));
for (SAMRecord r : output) {
assertEquals(BreakendDirection.Forward, new AssemblyAttributes(r).getAssemblyDirection());
}
}
Aggregations