Search in sources :

Example 1 with ReadPairConcordanceFilter

use of gridss.filter.ReadPairConcordanceFilter in project gridss by PapenfussLab.

the class ExtractSVReads method setup.

@Override
protected void setup(SAMFileHeader header, File samFile) {
    if (METRICS_OUTPUT != null) {
        metricsCollector = new CollectStructuralVariantReadMetrics();
        copyInput(metricsCollector);
        metricsCollector.OUTPUT = METRICS_OUTPUT;
        metricsCollector.setup(header, samFile);
    }
    SAMFileWriterFactory writerFactory = new SAMFileWriterFactory();
    if (header.getSortOrder() != SortOrder.queryname) {
        log.info("Not considering multiple read alignments as the input file is not queryname sorted.");
    }
    tmpoutput = gridss.Defaults.OUTPUT_TO_TEMP_FILE ? FileSystemContext.getWorkingFileFor(OUTPUT, "gridss.tmp.ExtractSVReads.") : OUTPUT;
    writer = writerFactory.makeSAMOrBAMWriter(header, true, tmpoutput);
    IndelReadFilter indelFilter = new IndelReadFilter(INDELS ? MIN_INDEL_SIZE : Integer.MAX_VALUE);
    ClippedReadFilter softClipFilter = new ClippedReadFilter(CLIPPED ? MIN_CLIP_LENGTH : Integer.MAX_VALUE);
    SplitReadFilter splitReadFilter = new SplitReadFilter();
    AlignedFilter unmappedFilter = new AlignedFilter(false);
    OneEndAnchoredReadFilter oeaFilter = new OneEndAnchoredReadFilter();
    ReadPairConcordanceFilter dpFilter = getReadPairConcordanceCalculator() != null ? new ReadPairConcordanceFilter(getReadPairConcordanceCalculator(), false, true) : null;
    List<SamRecordFilter> readfilters = new ArrayList<>();
    readfilters.add(indelFilter);
    readfilters.add(softClipFilter);
    if (SPLIT)
        readfilters.add(splitReadFilter);
    if (UNMAPPED_READS)
        readfilters.add(unmappedFilter);
    readfilter = new UnionAggregateFilter(readfilters);
    List<SamRecordFilter> pairfilters = new ArrayList<>();
    if (SINGLE_MAPPED_PAIRED)
        pairfilters.add(oeaFilter);
    if (dpFilter != null && DISCORDANT_READ_PAIRS)
        pairfilters.add(dpFilter);
    pairfilter = new UnionAggregateFilter(pairfilters);
    if (!SINGLE_MAPPED_PAIRED && !DISCORDANT_READ_PAIRS) {
        pairfilter = new FixedFilter(true);
    }
    count = 0;
}
Also used : FixedFilter(gridss.filter.FixedFilter) SamRecordFilter(htsjdk.samtools.filter.SamRecordFilter) IndelReadFilter(gridss.filter.IndelReadFilter) ArrayList(java.util.ArrayList) SAMFileWriterFactory(htsjdk.samtools.SAMFileWriterFactory) UnionAggregateFilter(gridss.filter.UnionAggregateFilter) CollectStructuralVariantReadMetrics(gridss.analysis.CollectStructuralVariantReadMetrics) SplitReadFilter(gridss.filter.SplitReadFilter) OneEndAnchoredReadFilter(gridss.filter.OneEndAnchoredReadFilter) ClippedReadFilter(gridss.filter.ClippedReadFilter) AlignedFilter(htsjdk.samtools.filter.AlignedFilter) ReadPairConcordanceFilter(gridss.filter.ReadPairConcordanceFilter)

Example 2 with ReadPairConcordanceFilter

use of gridss.filter.ReadPairConcordanceFilter in project gridss by PapenfussLab.

the class CollectStructuralVariantReadMetrics method setup.

@Override
public void setup(SAMFileHeader header, File samFile) {
    indelFilter = new IndelReadFilter(MIN_INDEL_SIZE);
    softClipFilter = new ClippedReadFilter(MIN_CLIP_LENGTH);
    splitReadFilter = new SplitReadFilter();
    unmappedFilter = new AlignedFilter(false);
    oeaFilter = new OneEndAnchoredReadFilter();
    dpFilter = getReadPairConcordanceCalculator() != null ? new ReadPairConcordanceFilter(getReadPairConcordanceCalculator(), false, true) : null;
    metrics = new StructuralVariantReadMetrics();
}
Also used : ClippedReadFilter(gridss.filter.ClippedReadFilter) IndelReadFilter(gridss.filter.IndelReadFilter) AlignedFilter(htsjdk.samtools.filter.AlignedFilter) SplitReadFilter(gridss.filter.SplitReadFilter) ReadPairConcordanceFilter(gridss.filter.ReadPairConcordanceFilter) OneEndAnchoredReadFilter(gridss.filter.OneEndAnchoredReadFilter)

Aggregations

ClippedReadFilter (gridss.filter.ClippedReadFilter)2 IndelReadFilter (gridss.filter.IndelReadFilter)2 OneEndAnchoredReadFilter (gridss.filter.OneEndAnchoredReadFilter)2 ReadPairConcordanceFilter (gridss.filter.ReadPairConcordanceFilter)2 SplitReadFilter (gridss.filter.SplitReadFilter)2 AlignedFilter (htsjdk.samtools.filter.AlignedFilter)2 CollectStructuralVariantReadMetrics (gridss.analysis.CollectStructuralVariantReadMetrics)1 FixedFilter (gridss.filter.FixedFilter)1 UnionAggregateFilter (gridss.filter.UnionAggregateFilter)1 SAMFileWriterFactory (htsjdk.samtools.SAMFileWriterFactory)1 SamRecordFilter (htsjdk.samtools.filter.SamRecordFilter)1 ArrayList (java.util.ArrayList)1