Search in sources :

Example 1 with WellformedReadFilter

use of org.broadinstitute.hellbender.engine.filters.WellformedReadFilter in project gatk by broadinstitute.

the class LocusWalker method getDefaultReadFilters.

/**
     * Returns the default list of CommandLineReadFilters that are used for this tool. The filters returned
     * by this method are subject to selective enabling/disabling by the user via the command line. The
     * default implementation uses the {@link WellformedReadFilter} and {@link ReadFilterLibrary.MappedReadFilter} filter
     * with all default options. Subclasses can override to provide alternative filters.
     *
     * Note: this method is called before command line parsing begins, and thus before a SAMFileHeader is
     * available through {link #getHeaderForReads}.
     *
     * @return List of individual filters to be applied for this tool.
     */
public List<ReadFilter> getDefaultReadFilters() {
    final List<ReadFilter> defaultFilters = new ArrayList<>(2);
    defaultFilters.add(new WellformedReadFilter());
    defaultFilters.add(new ReadFilterLibrary.MappedReadFilter());
    return defaultFilters;
}
Also used : WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter) ReadFilterLibrary(org.broadinstitute.hellbender.engine.filters.ReadFilterLibrary) CountingReadFilter(org.broadinstitute.hellbender.engine.filters.CountingReadFilter) ReadFilter(org.broadinstitute.hellbender.engine.filters.ReadFilter) WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter)

Example 2 with WellformedReadFilter

use of org.broadinstitute.hellbender.engine.filters.WellformedReadFilter in project gatk by broadinstitute.

the class AssemblyRegionWalkerSpark method getDefaultReadFilters.

@Override
public List<ReadFilter> getDefaultReadFilters() {
    final List<ReadFilter> defaultFilters = new ArrayList<>(2);
    defaultFilters.add(new WellformedReadFilter());
    defaultFilters.add(new ReadFilterLibrary.MappedReadFilter());
    return defaultFilters;
}
Also used : WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter) ArrayList(java.util.ArrayList) ReadFilterLibrary(org.broadinstitute.hellbender.engine.filters.ReadFilterLibrary) ReadFilter(org.broadinstitute.hellbender.engine.filters.ReadFilter) WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter)

Example 3 with WellformedReadFilter

use of org.broadinstitute.hellbender.engine.filters.WellformedReadFilter in project gatk by broadinstitute.

the class AssemblyRegionWalker method getDefaultReadFilters.

/**
     * Returns the default list of CommandLineReadFilters that are used for this tool. The filters
     * returned by this method are subject to selective enabling/disabling and customization by the
     * user via the command line. The default implementation uses the {@link WellformedReadFilter}
     * filter with all default options, as well as the {@link ReadFilterLibrary.MappedReadFilter}.
     * Subclasses can override to provide alternative filters.
     *
     * Note: this method is called before command line parsing begins, and thus before a SAMFileHeader is
     * available through {link #getHeaderForReads}.
     *
     * @return List of default filter instances to be applied for this tool.
     */
public List<ReadFilter> getDefaultReadFilters() {
    final List<ReadFilter> defaultFilters = new ArrayList<>(2);
    defaultFilters.add(new WellformedReadFilter());
    defaultFilters.add(new ReadFilterLibrary.MappedReadFilter());
    return defaultFilters;
}
Also used : WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter) ArrayList(java.util.ArrayList) ReadFilterLibrary(org.broadinstitute.hellbender.engine.filters.ReadFilterLibrary) CountingReadFilter(org.broadinstitute.hellbender.engine.filters.CountingReadFilter) ReadFilter(org.broadinstitute.hellbender.engine.filters.ReadFilter) WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter)

Example 4 with WellformedReadFilter

use of org.broadinstitute.hellbender.engine.filters.WellformedReadFilter in project gatk by broadinstitute.

the class AssemblyRegionUnitTest method testCreateFromReadShard.

@Test
public void testCreateFromReadShard() {
    final Path testBam = IOUtils.getPath(NA12878_20_21_WGS_bam);
    final File reference = new File(b37_reference_20_21);
    final SimpleInterval shardInterval = new SimpleInterval("20", 10000000, 10001000);
    final SimpleInterval paddedShardInterval = new SimpleInterval(shardInterval.getContig(), shardInterval.getStart() - 100, shardInterval.getEnd() + 100);
    // Traversal settings to match the GATK 3/4 HaplotypeCaller settings when the expected output was generated:
    final int minRegionSize = 50;
    final int maxRegionSize = 300;
    final int regionPadding = 100;
    final double activeProbThreshold = 0.002;
    final int maxProbPropagationDistance = 50;
    // This mock evaluator returns exactly the values that the GATK 4 HaplotypeCallerEngine's isActive()
    // method returns for this region. We don't have direct access to the HaplotypeCallerEngine since
    // we're in public, so we need to use a mock.
    final AssemblyRegionEvaluator mockEvaluator = new AssemblyRegionEvaluator() {

        private final List<SimpleInterval> activeSites = Arrays.asList(new SimpleInterval("20", 9999996, 9999996), new SimpleInterval("20", 9999997, 9999997), new SimpleInterval("20", 10000117, 10000117), new SimpleInterval("20", 10000211, 10000211), new SimpleInterval("20", 10000439, 10000439), new SimpleInterval("20", 10000598, 10000598), new SimpleInterval("20", 10000694, 10000694), new SimpleInterval("20", 10000758, 10000758), new SimpleInterval("20", 10001019, 10001019));

        @Override
        public ActivityProfileState isActive(AlignmentContext locusPileup, ReferenceContext referenceContext, FeatureContext featureContext) {
            final SimpleInterval pileupInterval = new SimpleInterval(locusPileup);
            return activeSites.contains(pileupInterval) ? new ActivityProfileState(pileupInterval, 1.0) : new ActivityProfileState(pileupInterval, 0.0);
        }
    };
    final List<Pair<SimpleInterval, Boolean>> expectedResults = Arrays.asList(// GATK 3.4's results).
    Pair.of(new SimpleInterval("20", 9999902, 9999953), false), Pair.of(new SimpleInterval("20", 9999954, 10000039), true), Pair.of(new SimpleInterval("20", 10000040, 10000079), false), Pair.of(new SimpleInterval("20", 10000080, 10000154), true), Pair.of(new SimpleInterval("20", 10000155, 10000173), false), Pair.of(new SimpleInterval("20", 10000174, 10000248), true), Pair.of(new SimpleInterval("20", 10000249, 10000401), false), Pair.of(new SimpleInterval("20", 10000402, 10000476), true), Pair.of(new SimpleInterval("20", 10000477, 10000560), false), Pair.of(new SimpleInterval("20", 10000561, 10000635), true), Pair.of(new SimpleInterval("20", 10000636, 10000656), false), Pair.of(new SimpleInterval("20", 10000657, 10000795), true), Pair.of(new SimpleInterval("20", 10000796, 10000981), false), Pair.of(new SimpleInterval("20", 10000982, 10001056), true), Pair.of(new SimpleInterval("20", 10001057, 10001100), false));
    try (final ReadsDataSource readsSource = new ReadsDataSource(testBam);
        final ReferenceDataSource refSource = new ReferenceFileSource(reference)) {
        // Set the shard's read filter to match the GATK 3/4 HaplotypeCaller settings when the expected output was generated:
        final LocalReadShard shard = new LocalReadShard(shardInterval, paddedShardInterval, readsSource);
        shard.setReadFilter(new CountingReadFilter(new MappingQualityReadFilter(20)).and(new CountingReadFilter(ReadFilterLibrary.MAPPING_QUALITY_AVAILABLE)).and(new CountingReadFilter(ReadFilterLibrary.MAPPED)).and(new CountingReadFilter(ReadFilterLibrary.PRIMARY_ALIGNMENT)).and(new CountingReadFilter(ReadFilterLibrary.NOT_DUPLICATE)).and(new CountingReadFilter(ReadFilterLibrary.PASSES_VENDOR_QUALITY_CHECK)).and(new CountingReadFilter(ReadFilterLibrary.GOOD_CIGAR)).and(new CountingReadFilter(new WellformedReadFilter(readsSource.getHeader()))));
        final Iterable<AssemblyRegion> assemblyRegions = AssemblyRegion.createFromReadShard(shard, readsSource.getHeader(), new ReferenceContext(refSource, paddedShardInterval), new FeatureContext(null, paddedShardInterval), mockEvaluator, minRegionSize, maxRegionSize, regionPadding, activeProbThreshold, maxProbPropagationDistance);
        int regionCount = 0;
        for (final AssemblyRegion region : assemblyRegions) {
            Assert.assertTrue(regionCount < expectedResults.size(), "Too many regions returned from AssemblyRegion.createFromReadShard()");
            Assert.assertEquals(region.getSpan(), expectedResults.get(regionCount).getLeft(), "Wrong interval for region");
            Assert.assertEquals(region.isActive(), expectedResults.get(regionCount).getRight().booleanValue(), "Region incorrectly marked as active/inactive");
            ++regionCount;
        }
        Assert.assertEquals(regionCount, expectedResults.size(), "Too few regions returned from AssemblyRegion.createFromReadShard()");
    }
}
Also used : Path(java.nio.file.Path) WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter) ActivityProfileState(org.broadinstitute.hellbender.utils.activityprofile.ActivityProfileState) CountingReadFilter(org.broadinstitute.hellbender.engine.filters.CountingReadFilter) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) CachingIndexedFastaSequenceFile(org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile) File(java.io.File) IndexedFastaSequenceFile(htsjdk.samtools.reference.IndexedFastaSequenceFile) Pair(org.apache.commons.lang3.tuple.Pair) MappingQualityReadFilter(org.broadinstitute.hellbender.engine.filters.MappingQualityReadFilter) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 5 with WellformedReadFilter

use of org.broadinstitute.hellbender.engine.filters.WellformedReadFilter in project gatk by broadinstitute.

the class PileupSpark method getDefaultReadFilters.

@Override
public List<ReadFilter> getDefaultReadFilters() {
    List<ReadFilter> filterList = new ArrayList<>(5);
    filterList.add(ReadFilterLibrary.MAPPED);
    filterList.add(ReadFilterLibrary.NOT_DUPLICATE);
    filterList.add(ReadFilterLibrary.PASSES_VENDOR_QUALITY_CHECK);
    filterList.add(ReadFilterLibrary.PRIMARY_ALIGNMENT);
    filterList.add(new WellformedReadFilter());
    return filterList;
}
Also used : WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter) ArrayList(java.util.ArrayList) ReadFilter(org.broadinstitute.hellbender.engine.filters.ReadFilter) WellformedReadFilter(org.broadinstitute.hellbender.engine.filters.WellformedReadFilter)

Aggregations

WellformedReadFilter (org.broadinstitute.hellbender.engine.filters.WellformedReadFilter)12 ReadFilter (org.broadinstitute.hellbender.engine.filters.ReadFilter)10 MappingQualityReadFilter (org.broadinstitute.hellbender.engine.filters.MappingQualityReadFilter)6 ArrayList (java.util.ArrayList)4 CountingReadFilter (org.broadinstitute.hellbender.engine.filters.CountingReadFilter)3 ReadFilterLibrary (org.broadinstitute.hellbender.engine.filters.ReadFilterLibrary)3 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)2 SAMFileHeader (htsjdk.samtools.SAMFileHeader)1 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)1 IndexedFastaSequenceFile (htsjdk.samtools.reference.IndexedFastaSequenceFile)1 File (java.io.File)1 Path (java.nio.file.Path)1 Pair (org.apache.commons.lang3.tuple.Pair)1 ReadsDataSource (org.broadinstitute.hellbender.engine.ReadsDataSource)1 ActivityProfileState (org.broadinstitute.hellbender.utils.activityprofile.ActivityProfileState)1 CachingIndexedFastaSequenceFile (org.broadinstitute.hellbender.utils.fasta.CachingIndexedFastaSequenceFile)1 LocusIteratorByState (org.broadinstitute.hellbender.utils.locusiterator.LocusIteratorByState)1 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)1 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1 Test (org.testng.annotations.Test)1