Search in sources :

Example 16 with SamRecordFilter

use of htsjdk.samtools.filter.SamRecordFilter in project ASCIIGenome by dariober.

the class UtilsTest method canCountReadsInWindow2.

@Test
public void canCountReadsInWindow2() throws InvalidGenomicCoordsException, IOException {
    GenomicCoords gc = new GenomicCoords("chr7:5524838-5611878", 80, samSeqDict, fastaFile);
    List<SamRecordFilter> filters = new ArrayList<SamRecordFilter>();
    assertEquals(100377, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
    filters.add(new AlignedFilter(true));
    assertEquals(100265, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
    filters = new ArrayList<SamRecordFilter>();
    filters.add(new AlignedFilter(true));
    filters.add(new ReadNegativeStrandFilter(false));
    assertEquals(50157, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
    filters = new ArrayList<SamRecordFilter>();
    filters.add(new AlignedFilter(true));
    filters.add(new ReadNegativeStrandFilter(true));
    assertEquals(50108, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
    filters = FlagToFilter.flagToFilterList(80, 1026);
    assertEquals(2729, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
    filters = FlagToFilter.flagToFilterList(80, 1026);
    filters.add(new MappingQualityFilter(30));
    assertEquals(1592, Utils.countReadsInWindow("test_data/ear045.oxBS.actb.bam", gc, filters));
}
Also used : MappingQualityFilter(htsjdk.samtools.filter.MappingQualityFilter) SamRecordFilter(htsjdk.samtools.filter.SamRecordFilter) AlignedFilter(htsjdk.samtools.filter.AlignedFilter) ArrayList(java.util.ArrayList) ReadNegativeStrandFilter(filter.ReadNegativeStrandFilter) Test(org.junit.Test)

Aggregations

SamRecordFilter (htsjdk.samtools.filter.SamRecordFilter)16 SamLocusIterator (htsjdk.samtools.util.SamLocusIterator)9 ArrayList (java.util.ArrayList)8 DuplicateReadFilter (htsjdk.samtools.filter.DuplicateReadFilter)7 NotPrimaryAlignmentFilter (htsjdk.samtools.filter.NotPrimaryAlignmentFilter)7 ReferenceSequenceFileWalker (htsjdk.samtools.reference.ReferenceSequenceFileWalker)6 IntervalList (htsjdk.samtools.util.IntervalList)6 File (java.io.File)6 SamReader (htsjdk.samtools.SamReader)5 List (java.util.List)5 UserException (org.broadinstitute.hellbender.exceptions.UserException)5 htsjdk.samtools (htsjdk.samtools)4 MappingQualityFilter (htsjdk.samtools.filter.MappingQualityFilter)4 IOException (java.io.IOException)4 Arrays (java.util.Arrays)4 LogManager (org.apache.logging.log4j.LogManager)4 Logger (org.apache.logging.log4j.Logger)4 Nucleotide (org.broadinstitute.hellbender.utils.Nucleotide)4 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)4 ParamUtils (org.broadinstitute.hellbender.utils.param.ParamUtils)4