use of au.edu.wehi.idsv.DiscordantReadPair in project gridss by PapenfussLab.
the class NonReferenceContigAssemblerTest method should_call_simple_fwd_RP.
@Test
public void should_call_simple_fwd_RP() {
ProcessingContext pc = getContext();
pc.getAssemblyParameters().k = 4;
SAMEvidenceSource ses = SES(100, 200);
DiscordantReadPair e = (DiscordantReadPair) NRRP(ses, withSequence("ACGTGGTCGACC", DP(0, 50, "12M", true, 1, 1, "12M", false)));
List<SAMRecord> output = go(pc, true, e);
assertEquals(1, output.size());
SoftClipEvidence ass = SoftClipEvidence.create(AES(ses), FWD, output.get(0));
assertEquals(e.getBreakendSummary().localBreakend(), ass.getBreakendSummary());
assertEquals("ACGTGGTCGACC", S(ass.getBreakendSequence()));
assertEquals("", S(ass.getAnchorSequence()));
}
use of au.edu.wehi.idsv.DiscordantReadPair in project gridss by PapenfussLab.
the class PathNodeIteratorTest method should_overlapping_adjacent_sc_rp.
@Test
public void should_overlapping_adjacent_sc_rp() {
SoftClipEvidence sc = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
DiscordantReadPair rp = (DiscordantReadPair) NRRP(SES(13, 200), withSequence("TCGACCTCCGGAA", DP(0, 25, "13M", true, 1, 1, "13M", false)));
List<KmerPathNode> result = asCheckedKPN(5, 1000, sc, rp);
assertCompleteGraph(result, 5);
assertEquals(5, result.size());
assertEquals(4, result.stream().mapToInt(n -> n.next().size()).sum());
assertEquals(4, result.stream().mapToInt(n -> n.prev().size()).sum());
}
use of au.edu.wehi.idsv.DiscordantReadPair in project gridss by PapenfussLab.
the class ContigCallerTest method should_assemble_overlapping_sc_rp.
@Test
public void should_assemble_overlapping_sc_rp() {
SoftClipEvidence sc = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
DiscordantReadPair rp = (DiscordantReadPair) NRRP(SES(10, 200), withSequence("GACCTCCGGAA", DP(0, 25, "11M", true, 1, 1, "11M", false)));
ArrayList<KmerPathNode> in = Lists.newArrayList(asKPN(4, 1000, sc, rp));
String result = S(getCaller(in, 1000).bestContig(Integer.MAX_VALUE), 4);
// assertEquals(3, result.size()); // SC+RP, RP starting before SC, RP starting after SC
assertEquals("TGGTCGACCTCCGGAA", result);
// assertEquals("GACCTCCGGAA", result.get(1));
// assertEquals("GACCTCCGGAA", result.get(2));
}
use of au.edu.wehi.idsv.DiscordantReadPair in project gridss by PapenfussLab.
the class ContigCallerTest method should_preference_anchored_paths.
@Test
public void should_preference_anchored_paths() {
// both sides anchored
SoftClipEvidence spanf = SCE(FWD, withSequence("TGTTAATTGT", Read(0, 1, "4M6S")));
SoftClipEvidence spanb = SCE(BWD, withSequence("TGTTAATTGT", Read(0, 7, "6S4M")));
// start anchored
SoftClipEvidence scf = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 5, "6M6S")));
// end anchored (but less support)
SoftClipEvidence scb = SCE(BWD, withSequence("GTCAGTC", Read(0, 5, "3S4M")));
// unanchored
DiscordantReadPair e = (DiscordantReadPair) NRRP(SES(20, 30), withSequence("GACCTCTACT", DP(0, 25, "10M", true, 1, 1, "10M", false)));
String result = S(getCaller(Lists.newArrayList(asKPN(4, 100, spanf, spanb, scf, scb, e)), 100).bestContig(Integer.MAX_VALUE), 4);
// assertEquals(4, result.size());
// only returns the unanchored kmers
assertEquals("GTTAATTG", result);
// assertEquals("TGGTCGACC", result.get(1));
// assertEquals("GTCAGT", result.get(2));
// assertEquals("GACCTCTACT", result.get(3));
}
use of au.edu.wehi.idsv.DiscordantReadPair in project gridss by PapenfussLab.
the class AllocateEvidenceTest method should_uniquely_assign.
@Test
public void should_uniquely_assign() throws IOException, InterruptedException, ExecutionException {
final int fragSize = 4;
final int testSize = 64;
final List<SAMRecord> in = new ArrayList<SAMRecord>();
final ProcessingContext pc = getCommandlineContext();
pc.getVariantCallingParameters().writeFiltered = true;
pc.getVariantCallingParameters().minScore = 0;
StubSAMEvidenceSource ses = new StubSAMEvidenceSource(pc, input, 0, 0, fragSize);
for (int i = 1; i < testSize; i++) {
for (int j = 1; j < testSize; j++) {
SAMRecord[] dp = withReadName(String.format("read-%d-%d", i, j), DP(0, i, "1M", true, 1, j, "1M", false));
ses.evidence.add(NonReferenceReadPair.create(dp[0], dp[1], ses));
ses.evidence.add(NonReferenceReadPair.create(dp[1], dp[0], ses));
in.add(dp[0]);
in.add(dp[1]);
}
}
StubAssemblyEvidenceSource aes = new StubAssemblyEvidenceSource(pc);
aes.fragSize = fragSize;
Collections.sort(ses.evidence, DirectedEvidenceOrder.ByNatural);
createInput(in);
VariantCaller vc = new VariantCaller(pc, ImmutableList.<SAMEvidenceSource>of(ses), aes);
ExecutorService threadpool = Executors.newSingleThreadExecutor();
vc.callBreakends(output, threadpool);
threadpool.shutdown();
AllocateEvidence cmd = new AllocateEvidence();
cmd.INPUT_VCF = output;
cmd.setContext(pc);
cmd.setAssemblySource(aes);
cmd.setSamEvidenceSources(ImmutableList.of(ses));
cmd.OUTPUT_VCF = new File(testFolder.getRoot(), "annotated.vcf");
cmd.ASSEMBLY = new File(testFolder.getRoot(), "assembly.bam");
// to shut up the command-line parsing
createBAM(cmd.ASSEMBLY, SortOrder.coordinate, Collections.emptyList());
cmd.doWork(null);
// List<IdsvVariantContext> annotated = getVcf(new File(testFolder.getRoot(), "out.vcf"), null);
List<IdsvVariantContext> rawcalls = getVcf(output, null);
List<IdsvVariantContext> calls = getVcf(cmd.OUTPUT_VCF, null);
assertSymmetrical(rawcalls.stream().map(x -> (VariantContextDirectedBreakpoint) x).collect(Collectors.toList()));
assertSymmetrical(calls.stream().map(x -> (VariantContextDirectedBreakpoint) x).collect(Collectors.toList()));
// with no filtering, annotation should not change call set
double expectedEvidence = 0;
for (DirectedEvidence e : ses.evidence) {
DiscordantReadPair bp = (DiscordantReadPair) e;
expectedEvidence += bp.getBreakpointQual();
}
double annotatedEvidence = 0;
for (IdsvVariantContext e : calls) {
annotatedEvidence += e.getPhredScaledQual();
}
double rawEvidence = rawcalls.stream().mapToDouble(e -> e.getPhredScaledQual()).sum();
// unique assignment must result in the evidence total being, at most, the same
assertTrue(annotatedEvidence <= rawEvidence);
// each piece of evidence should be assigned to a single breakpoint so totals should match
int rpCalls = calls.stream().mapToInt(v -> ((VariantContextDirectedBreakpoint) v).getBreakpointEvidenceCount()).sum();
assertEquals(ses.evidence.size(), rpCalls);
// floating point truncation on VCF is severe!
assertEquals(expectedEvidence, annotatedEvidence, 20);
}
Aggregations