Search in sources :

Example 16 with BreakpointSummary

use of au.edu.wehi.idsv.BreakpointSummary in project gridss by PapenfussLab.

the class BreakpointHomologyTest method should_reduce_window_size_for_small_events.

@Test
public void should_reduce_window_size_for_small_events() {
    BreakpointHomology bh = BreakpointHomology.calculate(SMALL_FA, new BreakpointSummary(0, FWD, 100, 0, BWD, 103), "", 100, 0);
    assertEquals(2, bh.getLocalHomologyLength());
    assertEquals(2, bh.getRemoteHomologyLength());
}
Also used : BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 17 with BreakpointSummary

use of au.edu.wehi.idsv.BreakpointSummary in project gridss by PapenfussLab.

the class BreakpointHomologyTest method should_not_exceed_contig_bounds.

@Test
public void should_not_exceed_contig_bounds() {
    InMemoryReferenceSequenceFile underlying = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCCCCCCCCC"), B("AAAAAAAAAAA") });
    // BreakpointHomology bh0 = BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 1, 1, BWD, 20), "", 50, 50);
    TwoBitBufferedReferenceSequenceFile ref = new TwoBitBufferedReferenceSequenceFile(underlying);
    for (int b1pos = 1; b1pos <= ref.getSequenceDictionary().getSequences().get(0).getSequenceLength(); b1pos++) {
        for (int b2pos = 1; b2pos <= ref.getSequenceDictionary().getSequences().get(0).getSequenceLength(); b2pos++) {
            for (BreakendDirection b1dir : BreakendDirection.values()) {
                for (BreakendDirection b2dir : BreakendDirection.values()) {
                    for (int maxBreakendLength = 1; maxBreakendLength < ref.getSequenceDictionary().getSequences().get(0).getSequenceLength() + 2; maxBreakendLength++) {
                        for (int margin = 0; margin < ref.getSequenceDictionary().getSequences().get(0).getSequenceLength() + 2; margin++) {
                            BreakpointHomology bh = BreakpointHomology.calculate(ref, new BreakpointSummary(0, b1dir, b1pos, 1, b2dir, b2pos), "", maxBreakendLength, margin);
                            assertEquals(0, bh.getLocalHomologyLength());
                            assertEquals(0, bh.getRemoteHomologyLength());
                        }
                    }
                }
            }
        }
    }
}
Also used : TwoBitBufferedReferenceSequenceFile(au.edu.wehi.idsv.picard.TwoBitBufferedReferenceSequenceFile) InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) BreakendDirection(au.edu.wehi.idsv.BreakendDirection) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 18 with BreakpointSummary

use of au.edu.wehi.idsv.BreakpointSummary in project gridss by PapenfussLab.

the class BreakpointHomologyTest method should_incorporate_inserted_sequence.

@Test
public void should_incorporate_inserted_sequence() {
    InMemoryReferenceSequenceFile ref = new InMemoryReferenceSequenceFile(new String[] { "0", "1" }, new byte[][] { B("CCCAAAATTTGGGAAAAAATTTTTTTTTTTTTTTTTTT"), B("TTTAAAATTTGGGAAAAAAGGGGGGGGGGGGGGGGGGG") });
    // CCCAAAATTT GGGAAAAAATTTTTTTTTTT TTTTTTTT"),
    // TTTAAAATTT GGGAAAAAAGGGGGGGGGGG GGGGGGGG"
    // MMMMMMMMMMMMMMMMMMMSSSSSSSSSSSS fwd
    // SSSMMMMMMMMMMMMMMMMMMMMMMMMMMMM bwd
    // 1234567890 1234567890
    // >G
    // <
    // 
    BreakpointHomology bh = BreakpointHomology.calculate(ref, new BreakpointSummary(0, FWD, 10, 1, BWD, 11), "c", 20, 10);
    assertEquals(7, bh.getLocalHomologyLength());
    assertEquals(9, bh.getRemoteHomologyLength());
}
Also used : InMemoryReferenceSequenceFile(au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 19 with BreakpointSummary

use of au.edu.wehi.idsv.BreakpointSummary in project gridss by PapenfussLab.

the class VariantCallingConfigurationTest method margin_should_linearly_reduce_from_margin_at_twice_margin_size_to_zero_at_1bp.

@Test
public void margin_should_linearly_reduce_from_margin_at_twice_margin_size_to_zero_at_1bp() {
    VariantCallingConfiguration config = new VariantCallingConfiguration(getDefaultConfig());
    config.breakendMargin = 10;
    int[] size = new int[] { 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
    int[] expectedMargin = new int[] { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0 };
    for (int i = 0; i < size.length; i++) {
        assertEquals(new BreakpointSummary(0, FWD, 100, 100 - expectedMargin[i], 100 + expectedMargin[i], 0, FWD, 100 + size[i], 100 - expectedMargin[i] + size[i], 100 + expectedMargin[i] + size[i]), config.withMargin(new BreakpointSummary(0, FWD, 100, 100, 100, 0, FWD, 100 + size[i], 100 + size[i], 100 + size[i])));
    }
}
Also used : BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint) Test(org.junit.Test)

Example 20 with BreakpointSummary

use of au.edu.wehi.idsv.BreakpointSummary in project gridss by PapenfussLab.

the class BedpeWriter method write.

public void write(VariantContextDirectedBreakpoint variant) throws IOException {
    BreakpointSummary bp = variant.getBreakendSummary();
    List<String> args = new ArrayList<>();
    if (includeUntemplatedSequence) {
        args.add(variant.getHomologySequence());
    }
    if (includeGridssVcfFields) {
        args.addAll(Arrays.asList(new String[] { Integer.toString(variant.getBreakpointEvidenceCountLocalAssembly()), Integer.toString(variant.getBreakpointEvidenceCountRemoteAssembly()), Integer.toString(variant.getBreakpointEvidenceCountSoftClip()), Integer.toString(variant.getBreakpointEvidenceCountReadPair()), Double.toString(variant.getBreakpointEvidenceQualLocalAssembly()), Double.toString(variant.getBreakpointEvidenceQualRemoteAssembly()), Double.toString(variant.getBreakpointEvidenceQualSoftClip()), Double.toString(variant.getBreakpointEvidenceQualReadPair()), Integer.toString(variant.getReferenceReadCount()), Integer.toString(variant.getReferenceReadPairCount()) }));
    }
    write(bp, variant.getID(), Double.toString(variant.getPhredScaledQual()), args.toArray(new String[0]));
}
Also used : ArrayList(java.util.ArrayList) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary)

Aggregations

BreakpointSummary (au.edu.wehi.idsv.BreakpointSummary)25 Test (org.junit.Test)19 BreakendSummary (au.edu.wehi.idsv.BreakendSummary)10 InMemoryReferenceSequenceFile (au.edu.wehi.idsv.picard.InMemoryReferenceSequenceFile)7 MockDirectedBreakpoint (au.edu.wehi.idsv.MockDirectedBreakpoint)4 BreakendDirection (au.edu.wehi.idsv.BreakendDirection)2 IdsvVariantContext (au.edu.wehi.idsv.IdsvVariantContext)2 IdsvVariantContextBuilder (au.edu.wehi.idsv.IdsvVariantContextBuilder)2 MockDirectedEvidence (au.edu.wehi.idsv.MockDirectedEvidence)2 VariantContextDirectedBreakpoint (au.edu.wehi.idsv.VariantContextDirectedBreakpoint)2 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)1 StructuralVariationCallBuilder (au.edu.wehi.idsv.StructuralVariationCallBuilder)1 VariantContextDirectedEvidence (au.edu.wehi.idsv.VariantContextDirectedEvidence)1 Node (au.edu.wehi.idsv.graph.MaximumCliqueIntervalGraph.Node)1 TwoBitBufferedReferenceSequenceFile (au.edu.wehi.idsv.picard.TwoBitBufferedReferenceSequenceFile)1 VcfFilter (au.edu.wehi.idsv.vcf.VcfFilter)1 VariantContext (htsjdk.variant.variantcontext.VariantContext)1 VariantContextWriter (htsjdk.variant.variantcontext.writer.VariantContextWriter)1 ArrayList (java.util.ArrayList)1 ExecutorService (java.util.concurrent.ExecutorService)1