Search in sources :

Example 1 with FixedFilter

use of gridss.filter.FixedFilter 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)

Aggregations

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