use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class NonReferenceContigAssemblerTest method should_call_suboptimal_contigs_if_graph_size_limit_exceeded.
@Test
public void should_call_suboptimal_contigs_if_graph_size_limit_exceeded() {
ProcessingContext pc = getContext();
MockSAMEvidenceSource ses = SES(10, 10);
pc.getAssemblyParameters().k = 4;
pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 1;
pc.getAssemblyParameters().positional.retainWidthMultiple = 1;
pc.getAssemblyParameters().positional.flushWidthMultiple = 2;
List<DirectedEvidence> e = new ArrayList<>();
for (int i = 0; i < 100; i++) {
for (int j = 0; j < i + 1; j++) {
e.add(SCE(FWD, ses, withReadName(String.format("%d-%d", i, j), withSequence("AACCGGTT", Read(0, i, "4M4S")))[0]));
}
}
List<SAMRecord> output = go(pc, false, e.toArray(new DirectedEvidence[0]));
assertEquals(100, output.size());
// unbounded execution would call high->low thus call the last contig first
// bounded execution will force the early calls to be made first
List<Integer> startPos = output.stream().map(x -> x.getAlignmentStart()).collect(Collectors.toList());
assertFalse(Ordering.natural().reverse().isOrdered(startPos));
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class NonReferenceContigAssemblerTest method should_not_remove_misassembled_partial_paths_when_could_be_collapsed_with_adjacent_read.
@Test
public void should_not_remove_misassembled_partial_paths_when_could_be_collapsed_with_adjacent_read() {
ProcessingContext pc = getContext();
MockSAMEvidenceSource ses = SES(10, 10);
pc.getAssemblyParameters().k = 2;
pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 5;
pc.getAssemblyParameters().removeMisassembledPartialContigsDuringAssembly = true;
pc.getAssemblyParameters().positional.flushWidthMultiple = 100000;
pc.getAssemblyParameters().positional.maxPathLengthMultiple = 4;
List<DirectedEvidence> e = new ArrayList<>();
for (int i = 1; i < 1000; i += 1) {
SAMRecord[] rp = OEA(0, i, "2M", true);
rp[0].setReadBases(B("GG"));
// expect reverse comp of read sequence
rp[1].setReadBases(B("AA"));
e.add(NRRP(ses, rp));
}
go(pc, true, e.toArray(new DirectedEvidence[0]));
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class NonReferenceContigAssemblerTest method should_remove_fully_reference_evidence_before_end.
@Test
public void should_remove_fully_reference_evidence_before_end() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().k = 4;
int n = 8;
DirectedEvidence[] input = new DirectedEvidence[2 * n];
for (int i = 0; i < n; i++) {
input[2 * i] = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 1000 * i, "6M6S")));
input[2 * i + 1] = SCE(FWD, withSequence("AACGTGG", Read(0, 1000 * i - 1, "6M1S")));
}
NonReferenceContigAssembler caller = create(pc, true, input);
for (int i = 0; i < n / 2; i++) {
caller.next();
}
assertTrue(caller.tracking_activeNodes() <= 3);
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class AggregateNodeIteratorTest method should_aggregate_kmer_weights.
@Test
public void should_aggregate_kmer_weights() {
int k = 4;
SAMEvidenceSource ses = SES(30, 60);
List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
input.add(NRRP(ses, withQual(new byte[] { 1, 1, 1, 1, 1 }, withSequence("ACGTT", DP(0, 1, "5M", false, 1, 1, "5M", false)))));
input.add(NRRP(ses, withQual(new byte[] { 1, 1, 1, 1, 1 }, withSequence("ACGTT", DP(0, 2, "5M", false, 1, 1, "5M", false)))));
Collections.sort(input, DirectedEvidence.ByStartEnd);
List<KmerSupportNode> snList = Lists.newArrayList(new SupportNodeIterator(k, input.iterator(), ses.getMaxConcordantFragmentSize(), null, false, 0));
List<KmerNode> anList = Lists.newArrayList(new AggregateNodeIterator(snList.iterator()));
assertTrue(KmerNodeUtil.ByLastStart.isOrdered(anList));
assertEquals(4, snList.size());
assertEquals(6, anList.size());
}
use of au.edu.wehi.idsv.DirectedEvidence in project gridss by PapenfussLab.
the class CallVariantsTest method test_sr_rp_assembly.
@Test
public void test_sr_rp_assembly() throws IOException {
List<DirectedEvidence> in = new ArrayList<DirectedEvidence>();
in.add(SCE(FWD, withSequence("AACCGGTTCTA", Read(0, 15, "5M6S"))));
in.add(SCE(FWD, withSequence("AACCGGTTCTA", Read(0, 15, "6M5S"))));
in.add(NRRP(withSequence("AACCGGTTCTA", DP(0, 1, "11M", true, 1, 100, "11M", false))));
in.add(NRRP(withSequence("AACCGGTTCTA", DP(0, 2, "11M", true, 1, 100, "11M", false))));
List<SAMRecord> insam = in.stream().flatMap(de -> {
if (de instanceof SoftClipEvidence)
return ImmutableList.<SAMRecord>of(((SoftClipEvidence) de).getSAMRecord()).stream();
if (de instanceof NonReferenceReadPair)
return ImmutableList.<SAMRecord>of(((NonReferenceReadPair) de).getNonReferenceRead(), ((NonReferenceReadPair) de).getLocalledMappedRead()).stream();
throw new RuntimeException("NYI");
}).collect(Collectors.toList());
insam.addAll(Lists.newArrayList(RP(0, 1, 100, 10)));
createInput(insam);
File propfile = testFolder.newFile("custom.properties");
try (BufferedWriter writer = new BufferedWriter(new FileWriter(propfile))) {
writer.write("assembly.k=5\n");
writer.write("softclip.minLength=1\n");
writer.write("minAnchorShannonEntropy=0\n");
writer.write("softclip.minAnchorIdentity=0\n");
writer.write("softclip.minAverageQual=0\n");
writer.write("realignment.aligner=\n");
}
File assembly = new File(testFolder.getRoot(), "assembly.bam");
String[] args = new String[] { "INPUT=" + input.toString(), "ASSEMBLY=" + assembly.toString(), "REFERENCE_SEQUENCE=" + reference.toString(), "OUTPUT=" + output.toString(), "TMP_DIR=" + super.testFolder.getRoot().toString(), "WORKING_DIR=" + super.testFolder.getRoot().toString(), "CONFIGURATION_FILE=" + propfile.toString(), "INPUT_MIN_FRAGMENT_SIZE=10", "INPUT_MAX_FRAGMENT_SIZE=100" };
assertEquals(0, new CallVariants().instanceMain(args));
List<SAMRecord> breakendAssemblies = getRecords(assembly);
assertEquals(1, breakendAssemblies.size());
assembly.delete();
}
Aggregations