def test_quality_filter(self): reads = Reads(self.sam1_file) reads.filter_quality(30, queue=False) for row in reads._reads._iter_visible_and_masked(): if row['mapq'] < 30: assert row[reads._reads._mask_field] == 2 else: assert row[reads._reads._mask_field] == 0 reads.close()
def test_queue_filters(self): reads = Reads(self.sam1_file) l = len(reads) reads.filter_quality(30, queue=True) reads.filter_non_unique(strict=True, queue=True) assert len(reads) == l reads.run_queued_filters() assert len(reads) < l reads.close()
def test_iterate_exclude_filters(self): reads = Reads(self.sam1_file) reads.filter_unmapped(queue=True) reads.filter_quality(35, queue=True) reads.filter_non_unique(strict=True, queue=True) reads.run_queued_filters() assert len( list( reads.reads( excluded_filters=['unmapped', 'mapq', 'uniqueness' ]))) == 271 assert len( list(reads.reads( excluded_filters=['unmapped', 'uniqueness']))) == 246 assert len(list( reads.reads(excluded_filters=['unmapped', 'mapq']))) == 153 assert len(list( reads.reads(excluded_filters=['mapq', 'uniqueness']))) == 271 assert len(list(reads.reads(excluded_filters=['unmapped']))) == 153 assert len(list(reads.reads(excluded_filters=['mapq']))) == 153 assert len(list(reads.reads(excluded_filters=['uniqueness']))) == 246 reads.close()