Search in sources :

Example 1 with GridssConfiguration

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

the class TestHelper method getConfig.

public static GridssConfiguration getConfig(File workingDirectory) {
    GridssConfiguration config;
    config = new GridssConfiguration(getDefaultConfig(), workingDirectory);
    config.getSoftClip().minAverageQual = 0;
    config.minAnchorShannonEntropy = 0;
    config.getAssembly().minReads = 2;
    config.getAssembly().positional.trimSelfIntersectingReads = false;
    config.getVariantCalling().breakendMargin = 3;
    config.getVisualisation().buffers = false;
    return config;
}
Also used : GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration)

Example 2 with GridssConfiguration

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

the class SAMRecordAssemblyEvidenceTest method realign_should_fix_778_chr1_170849702_misalignment.

@Test
public void realign_should_fix_778_chr1_170849702_misalignment() throws ConfigurationException {
    String assembly = "ATCCATCCCTATGACCCAAACATCTCCCACCAGGCCTCATGTTCAATATTAAAGATCACATTTCAACTTGAGATTTGGAGGGGACAAACATACAAATCATATCATTATCTCTCTCCCCACTTCTCTCTTTATCAATCCCTCCCTCTTTGTCAATCTTAGCCTTGGCCTTCAGATTTTACCACTTGATTTTTCACATTTTCTGTATTCTTAAT" + "GATTATTATATTTTCATGTTCTTGCTAATCTATATCATGGTTAGAAATCAAAGCATGCCGAAATTTCTCTCTTACTTTTTTTGCTGTT";
    File ref = new File("src/test/resources/chr1_170849600_170849850.fa");
    ProcessingContext context = new ProcessingContext(getFSContext(), ref, null, new ArrayList<Header>(), new GridssConfiguration());
    context.registerCategory("input.bam");
    SAMRecord e = AssemblyFactory.createAnchoredBreakend(context, AES(context), new SequentialIdGenerator("asm"), BWD, null, 0, 170849702 - 170849600 + 1, 97, B(assembly), B(40, assembly.length()));
    e = SAMRecordUtil.realign(context.getReference(), e, 50, true);
    // anchor location is 11bp off
    assertEquals("212S88M", e.getCigarString());
    assertEquals(170849713 - 170849600 + 1, asAssemblyEvidence(e).getBreakendSummary().start);
}
Also used : GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration) Header(htsjdk.samtools.metrics.Header) SAMRecord(htsjdk.samtools.SAMRecord) File(java.io.File) Test(org.junit.Test)

Example 3 with GridssConfiguration

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

the class SAMEvidenceSource method shouldFilter.

public boolean shouldFilter(DirectedEvidence e) {
    BreakendSummary bs = e.getBreakendSummary();
    if (getBlacklistedRegions().overlaps(bs.referenceIndex, bs.start - 1, bs.end + 1)) {
        return true;
    }
    GridssConfiguration config = getContext().getConfig();
    if (e instanceof SingleReadEvidence) {
        if (((SingleReadEvidence) e).isReference()) {
            return true;
        }
    }
    if (e instanceof SoftClipEvidence) {
        SoftClipEvidence sce = (SoftClipEvidence) e;
        SoftClipConfiguration scc = config.getSoftClip();
        if (sce.getBreakendSequence().length < scc.minLength)
            return true;
        if (average(sce.getBreakendQuality()) < scc.minAverageQual)
            return true;
        if (config.adapters.isAdapterSoftClip(sce))
            return true;
        if (!AssemblyAttributes.isAssembly(sce.getSAMRecord())) {
            // TODO: symmetrical identity and entropy filters on both sides
            if (SAMRecordUtil.getAlignedIdentity(sce.getSAMRecord()) < scc.minAnchorIdentity)
                return true;
            if (SAMRecordUtil.alignedEntropy(sce.getSAMRecord()) < config.minAnchorShannonEntropy)
                return true;
        }
    }
    if (e instanceof IndelEvidence) {
    // Currently filtering small indels in evidence iterator itself
    }
    if (e instanceof DirectedBreakpoint) {
        BreakpointSummary bp = (BreakpointSummary) e.getBreakendSummary();
        if (getBlacklistedRegions().overlaps(bp.referenceIndex2, bp.start2 - 1, bp.end2 + 1)) {
            return true;
        }
    // Still do assembly - leave the filtering to the variant calling
    // if (bp.getEventSize() != null && bp.getEventSize() < config.getVariantCalling().minSize) {
    // return true;
    // }
    }
    return false;
}
Also used : GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration) SoftClipConfiguration(au.edu.wehi.idsv.configuration.SoftClipConfiguration)

Example 4 with GridssConfiguration

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

the class SoftClipEvidenceTest method adapter.

private void adapter(String seq, int scLen, boolean keep) {
    SAMEvidenceSource ses = permissiveSES();
    try {
        ses.getContext().getConfig().adapters = new GridssConfiguration().adapters;
    } catch (ConfigurationException e) {
    }
    SAMRecord r = Read(0, 1000, String.format("%dM%dS", seq.length() - scLen, scLen));
    r.setReadBases(B(seq));
    r.setReadNegativeStrandFlag(false);
    assertEquals(keep, !ses.shouldFilter(SoftClipEvidence.create(ses, FWD, r)));
    // reverse comp
    r = Read(0, 1000, String.format("%dS%dM", scLen, seq.length() - scLen));
    r.setReadBases(B(SequenceUtil.reverseComplement(seq)));
    r.setReadNegativeStrandFlag(true);
    assertEquals(keep, !ses.shouldFilter(SoftClipEvidence.create(ses, BWD, r)));
}
Also used : GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration) ConfigurationException(org.apache.commons.configuration.ConfigurationException) SAMRecord(htsjdk.samtools.SAMRecord)

Example 5 with GridssConfiguration

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

the class Manual method debug778sorting.

/**
 * Test our iterators are behaving correctly
 * @throws IOException
 */
// @Test
@Category(Hg19Tests.class)
public void debug778sorting() throws ConfigurationException, IOException {
    ProcessingContext pc = new ProcessingContext(new FileSystemContext(new File("W:\\778\\idsv"), new File("W:\\778\\idsv"), 500000), Hg19Tests.findHg19Reference(), null, new ArrayList<Header>(), new GridssConfiguration());
    List<SAMEvidenceSource> samEvidence = new ArrayList<SAMEvidenceSource>();
    for (String s : new String[] { "W:\\778\\DNA_778_HiSeq_35nt_PE1_bt2_s_rg_cleaned.bam", "W:\\778\\DNA_778_IL_35nt_PE1_bt2_s_rg_cleaned.bam", "W:\\778\\DNA_778_IL_75nt_PE1_bt2_s_rg_cleaned.bam", "W:\\778\\DNA_778_PM_75nt_PE1_bt2_s_rg_cleaned.bam", "W:\\778\\DNA_778_PM_lane1_100nt_PE1_bt2_s_rg_cleaned.bam", "W:\\778\\DNA_778_PM_lane2_100nt_PE1_bt2_s_rg_cleaned.bam" }) {
        SAMEvidenceSource ses = new SAMEvidenceSource(pc, new File(s), null, 0);
        // Iterator<DirectedEvidence> it = ses.iterator(true, true, true);
        // while (it.hasNext()) {
        // it.next();
        // }
        samEvidence.add(ses);
    }
    AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, samEvidence, new File("W:\778\\idsv\\778.vcf.idsv.working"));
    aes.assembleBreakends(null);
    // Iterator<SAMRecordAssemblyEvidence> it = aes.iterator(true, true);
    // while (it.hasNext()) {
    // it.next();
    // }
    Iterator<DirectedEvidence> allIt = SAMEvidenceSource.mergedIterator(samEvidence, false);
    while (allIt.hasNext()) {
        allIt.next();
    }
}
Also used : ArrayList(java.util.ArrayList) GridssConfiguration(au.edu.wehi.idsv.configuration.GridssConfiguration) Header(htsjdk.samtools.metrics.Header) File(java.io.File) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) Category(org.junit.experimental.categories.Category)

Aggregations

GridssConfiguration (au.edu.wehi.idsv.configuration.GridssConfiguration)6 SAMRecord (htsjdk.samtools.SAMRecord)2 Header (htsjdk.samtools.metrics.Header)2 File (java.io.File)2 ConfigurationException (org.apache.commons.configuration.ConfigurationException)2 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)1 SoftClipConfiguration (au.edu.wehi.idsv.configuration.SoftClipConfiguration)1 IndexedFastaSequenceFile (htsjdk.samtools.reference.IndexedFastaSequenceFile)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Category (org.junit.experimental.categories.Category)1