seismicrna.filter package
- seismicrna.filter.run(input_path: Iterable[str | Path] = Sentinel.UNSET, *, branch: str = '', tmp_pfx: str | Path = './tmp', keep_tmp: bool = False, region_coords: Iterable[tuple[str, int, int]] = (), region_primers: Iterable[tuple[str, DNA, DNA]] = (), primer_gap: int = 0, regions_file: str | None = None, count_del: bool = True, count_ins: bool = True, no_mut: Iterable[str] = (), only_mut: Iterable[str] = (), probe: str = 'DMS', mask_a: bool | None = None, mask_c: bool | None = None, mask_g: bool | None = None, mask_u: bool | None = None, mask_polya: int | None = None, mask_pos: Iterable[tuple[str, int]] = (), mask_pos_file: Iterable[str | Path] = (), drop_read: Iterable[str] = (), drop_read_file: Iterable[str | Path] = (), drop_discontig: bool = True, min_ninfo_pos: int = 1000, max_fmut_pos: float = 1.0, min_ncov_read: int = 1, min_fcov_read: float = 0.0, min_finfo_read: float = 0.95, max_fmut_read: float = 1.0, min_mut_gap: int | None = None, mut_collisions: str = 'auto', quick_unbias: bool = True, quick_unbias_thresh: float = 0.001, max_filter_iter: int = 0, filter_pos_table: bool = True, filter_read_table: bool = True, brotli_level: int = 10, self_contained: bool = False, num_cpus: int = 4, force: bool = False) list[Path]
Define mutations and regions to filter reads and positions.
- Parameters:
branch (
str) – Create a new branch of the workflow with this name [keyword-only, default: ‘’]tmp_pfx (
str | pathlib._local.Path) – Write all temporary files to a directory with this prefix [keyword-only, default: ‘./tmp’]keep_tmp (
bool) – Keep temporary files after finishing [keyword-only, default: False]region_coords (
Iterable) – Select a region of a reference given its 5’ and 3’ end coordinates [keyword-only, default: ()]region_primers (
Iterable) – Select a region of a reference given its forward and reverse primers [keyword-only, default: ()]primer_gap (
int) – Leave a gap of this many bases between the primer and the region [keyword-only, default: 0]regions_file (
str | None) – Select regions of references from coordinates/primers in a CSV file [keyword-only, default: None]count_del (
bool) – Count deletions as mutations [keyword-only, default: True]count_ins (
bool) – Count insertions as mutations [keyword-only, default: True]no_mut (
Iterable) – Do not count this type of mutation (overrides –count-del/ins) [keyword-only, default: ()]only_mut (
Iterable) – Count only this type of mutation (overrides other mutation settings) [keyword-only, default: ()]probe (
str) – Use the default options for this chemical probe [keyword-only, default: ‘DMS’]mask_a (
bool | None) – Mask positions with base A [keyword-only, default: None]mask_c (
bool | None) – Mask positions with base C [keyword-only, default: None]mask_g (
bool | None) – Mask positions with base G [keyword-only, default: None]mask_u (
bool | None) – Mask positions with base U [keyword-only, default: None]mask_polya (
int | None) – Mask stretches of at least this many consecutive A bases (0 disables); defaults to 5 for chemical probes, 0 for none [keyword-only, default: None]mask_pos (
Iterable) – Mask this position in this reference [keyword-only, default: ()]mask_pos_file (
Iterable) – Mask positions in references from a file [keyword-only, default: ()]drop_read (
Iterable) – Drop the read with this name [keyword-only, default: ()]drop_read_file (
Iterable) – Drop the reads with names in this file [keyword-only, default: ()]drop_discontig (
bool) – Drop paired-end reads with discontiguous mates [keyword-only, default: True]min_ninfo_pos (
int) – Mask positions with fewer than this many informative base calls [keyword-only, default: 1000]max_fmut_pos (
float) – Mask positions with more than this fraction of mutated base calls [keyword-only, default: 1.0]min_ncov_read (
int) – Drop reads with fewer than this many bases covering the region [keyword-only, default: 1]min_fcov_read (
float) – Drop reads covering less than this fraction of the region [keyword-only, default: 0.0]min_finfo_read (
float) – Drop reads with less than this fraction of informative base calls [keyword-only, default: 0.95]max_fmut_read (
float) – Drop reads with more than this fraction of mutated base calls [keyword-only, default: 1.0]min_mut_gap (
int | None) – Filter out mutations separated by fewer than this many bases [keyword-only, default: None]mut_collisions (
str) – If two mutations are closer than –min-mut-gap positions, MERGE the mutations, DROP the read, or AUTO-select based on the probe. [keyword-only, default: ‘auto’]quick_unbias (
bool) – Correct observer bias using a quick (typically linear time) heuristic [keyword-only, default: True]quick_unbias_thresh (
float) – Treat mutated fractions under this threshold as 0 with –quick-unbias [keyword-only, default: 0.001]max_filter_iter (
int) – Stop the filter step after this many iterations (0 for no limit) [keyword-only, default: 0]filter_pos_table (
bool) – Tabulate relationships per position for filter data [keyword-only, default: True]filter_read_table (
bool) – Tabulate relationships per read for filter data [keyword-only, default: True]brotli_level (
int) – Compress pickle files with this level of Brotli (0 - 11) [keyword-only, default: 10]self_contained (
bool) – Write self-contained batch files that do not require loading predecessor batches (Filter and Cluster steps), at the cost of larger files on disk [keyword-only, default: False]num_cpus (
int) – Use up to this many CPUs simultaneously [keyword-only, default: 4]force (
bool) – Force all tasks to run, overwriting any existing output files [keyword-only, default: False]
Subpackages
- seismicrna.filter.tests package
- Submodules
TestFilterTestFilter1BatchTestFilter1SampleTestFilter2SamplesTestFilterBatchesTestFilterPairedTestFilterSingleTestFilterSingle1Sample1BatchTestFilterSingle1Sample1Batch.test_all_no_mut_min_ncov_read_7()TestFilterSingle1Sample1Batch.test_dms_min_ncov_read_5()TestFilterSingle1Sample1Batch.test_dms_min_ncov_read_6()TestFilterSingle1Sample1Batch.test_drop_discontig()TestFilterSingle1Sample1Batch.test_drop_read()TestFilterSingle1Sample1Batch.test_drop_read_and_drop_read_file()TestFilterSingle1Sample1Batch.test_drop_read_file()TestFilterSingle1Sample1Batch.test_drop_read_files()TestFilterSingle1Sample1Batch.test_mask_a()TestFilterSingle1Sample1Batch.test_mask_c()TestFilterSingle1Sample1Batch.test_mask_g()TestFilterSingle1Sample1Batch.test_mask_polya_3()TestFilterSingle1Sample1Batch.test_mask_polya_4()TestFilterSingle1Sample1Batch.test_mask_pos()TestFilterSingle1Sample1Batch.test_mask_pos_all()TestFilterSingle1Sample1Batch.test_mask_pos_and_mask_pos_file()TestFilterSingle1Sample1Batch.test_mask_pos_file()TestFilterSingle1Sample1Batch.test_mask_pos_files()TestFilterSingle1Sample1Batch.test_mask_pos_min_ncov_read_5()TestFilterSingle1Sample1Batch.test_mask_pos_min_ncov_read_6()TestFilterSingle1Sample1Batch.test_mask_pos_multiple()TestFilterSingle1Sample1Batch.test_mask_u()TestFilterSingle1Sample1Batch.test_min_fcov_read_amplicons()TestFilterSingle1Sample1Batch.test_min_finfo_read_1()TestFilterSingle1Sample1Batch.test_min_ncov_read_6()TestFilterSingle1Sample1Batch.test_min_ncov_read_7()TestFilterSingle1Sample1Batch.test_min_ncov_read_8()TestFilterSingle1Sample1Batch.test_nomask()TestFilterSingle1Sample1Batch.test_only_mut_ag_min_ninfo_pos_6()TestFilterSingle1Sample1Batch.test_probe_dms()TestFilterSingle1Sample1Batch.test_probe_dms_mask_a()TestFilterSingle1Sample1Batch.test_probe_dms_mask_c()TestFilterSingle1Sample1Batch.test_probe_dms_nomask_g()TestFilterSingle1Sample1Batch.test_probe_dms_nomask_u()TestFilterSingle1Sample1Batch.test_probe_etc()TestFilterSingle1Sample1Batch.test_probe_etc_mask_g()TestFilterSingle1Sample1Batch.test_probe_etc_mask_u()TestFilterSingle1Sample1Batch.test_probe_etc_nomask_a()TestFilterSingle1Sample1Batch.test_probe_etc_nomask_c()TestFilterSingle1Sample1Batch.test_probe_shape()
TestSetMaskPolyaTestSetMaskPolya.test_dms_default()TestSetMaskPolya.test_etc_default()TestSetMaskPolya.test_explicit_value_none_default()TestSetMaskPolya.test_explicit_value_overrides_default()TestSetMaskPolya.test_explicit_zero_overrides_probe_default()TestSetMaskPolya.test_none_default()TestSetMaskPolya.test_shape_default()
TestSetMutGapParamsTestSetMutGapParams.test_auto_collisions_resolves_for_none_probe()TestSetMutGapParams.test_dms_default_collisions()TestSetMutGapParams.test_dms_default_gap()TestSetMutGapParams.test_etc_default_collisions()TestSetMutGapParams.test_etc_default_gap()TestSetMutGapParams.test_explicit_collisions_drop_overrides_auto()TestSetMutGapParams.test_explicit_collisions_merge_overrides_auto()TestSetMutGapParams.test_explicit_gap_and_collisions()TestSetMutGapParams.test_explicit_gap_overrides_default()TestSetMutGapParams.test_explicit_zero_gap_overrides_default()TestSetMutGapParams.test_none_default_collisions()TestSetMutGapParams.test_none_default_gap()TestSetMutGapParams.test_shape_default_collisions()TestSetMutGapParams.test_shape_default_gap()
extract_positions()extract_read_nums()write_datasets()
- Submodules
Submodules
- class seismicrna.filter.batch.FilterMutsBatch(*, read_nums: np.ndarray, **kwargs)
Bases:
FilterReadBatch,PartialRegionMutsBatch- property read_weights
Weights for each read when computing counts.
- class seismicrna.filter.batch.FilterReadBatch(*, read_nums: np.ndarray, **kwargs)
Bases:
PartialReadBatch- property num_reads
Number of reads.
- property read_nums
Read numbers.
- class seismicrna.filter.batch.PartialReadBatch(*, batch: int, **kwargs)
-
- property max_read
Maximum possible value for a read index.
- property read_indexes
Map each read number to its index in self.read_nums.
- class seismicrna.filter.batch.PartialRegionMutsBatch(*, region: Region, **kwargs)
Bases:
PartialReadBatch,RegionMutsBatch,ABC
- seismicrna.filter.batch.apply_filters(batch: RegionMutsBatch, read_nums: np.ndarray | None = None, region: Region | None = None, sanitize: bool = False)
Apply read/position filters to a batch, returning a FilterMutsBatch.
- Parameters:
batch (
RegionMutsBatch) – Source batch to filter.read_nums (
np.ndarrayorNone, optional) – Array of read numbers to keep; if None, all reads are kept.region (
RegionorNone, optional) – Region to clip reads to; if None, the batch’s existing region is used.sanitize (
bool, optional) – Whether to run extra validation checks on the new batch (default False).
- Returns:
A new batch containing only the filtered reads and positions.
- Return type:
- class seismicrna.filter.dataset.FilterDataset(report_file: str | Path, verify_times: bool = True)
Bases:
AverageDataset,ABCDataset of filtered data.
- class seismicrna.filter.dataset.FilterMutsDataset(dataset2_report_file: Path, **kwargs)
Bases:
FilterDataset,MultistepDataset,UnbiasDatasetChain mutation data with filtered reads.
- FILTER_NAME = 'filter'
- classmethod get_dataset1_load_func()
Function to load Dataset 1.
- classmethod get_dataset2_type()
Type of Dataset 2.
- property min_mut_gap
Minimum gap between two mutations.
- property mut_collisions
Method for handling mutations that are too close.
- property pattern
Pattern of mutations to count.
- property probe
Chemical probe used for the experiment.
- property quick_unbias
Use the quick heuristic for unbiasing.
- property quick_unbias_thresh
Consider mutation rates less than or equal to this threshold to be 0 when using the quick heuristic for unbiasing.
- property region
Region of the dataset.
- class seismicrna.filter.dataset.FilterReadDataset(*args, masked_read_nums: dict[int, list] | None = None, **kwargs)
Bases:
FilterDataset,LoadedDataset,UnbiasDatasetLoad batches of filtered data.
- classmethod get_batch_type()
Type of batch.
- classmethod get_report_type()
Type of report.
- property min_mut_gap
Minimum gap between two mutations.
- property mut_collisions
Method for handling mutations that are too close.
- property pattern
Pattern of mutations to count.
- property pos_kept
Positions kept after filtering.
- property probe
Chemical probe used for the experiment.
- property quick_unbias
Use the quick heuristic for unbiasing.
- property quick_unbias_thresh
Consider mutation rates less than or equal to this threshold to be 0 when using the quick heuristic for unbiasing.
- class seismicrna.filter.dataset.JoinFilterMutsDataset(*args, **kwargs)
Bases:
FilterDataset,JoinMutsDataset,MergedUnbiasDataset- classmethod get_batch_type()
Type of batch.
- classmethod get_dataset_load_func()
Function to load one constituent dataset.
- classmethod get_report_type()
Type of report.
- classmethod name_batch_attrs()
Name the attributes of each batch.
- class seismicrna.filter.io.FilterBatchIO(*args, region: Region | None = None, seg_end5s: np.ndarray | None = None, seg_end3s: np.ndarray | None = None, muts: dict | None = None, **kwargs)
Bases:
FilterReadBatch,ReadBatchIO,RegBrickleIO,FilterIO- classmethod get_file_seg_type()
Type of the last segment in the path.
- to_muts_batch() FilterMutsBatch
Build a FilterMutsBatch from stored self-contained data.
- class seismicrna.filter.io.FilterFile
Bases:
HasRegFilePath,ABC- classmethod get_step()
Step of the workflow.
- class seismicrna.filter.io.FilterIO
Bases:
FilterFile,RegFileIO,ABC
- class seismicrna.filter.lists.FilterList(*, reg: str, **kwargs)
Bases:
List,FilterFile,ABC
- class seismicrna.filter.lists.FilterPositionList(*, reg: str, **kwargs)
Bases:
PositionList,FilterList- classmethod get_table_type()
Type of table that this type of list can process.
- classmethod list_init_table_attrs()
List the table attribute names to pass to __init__().
- seismicrna.filter.main.load_regions(input_path: Iterable[str | Path], coords: Iterable[tuple[str, int, int]], primers: Iterable[tuple[str, DNA, DNA]], primer_gap: int, regions_file: Path | None = None)
Load regions of idmut reports.
- seismicrna.filter.main.run(input_path: Iterable[str | Path] = Sentinel.UNSET, *, branch: str = '', tmp_pfx: str | Path = './tmp', keep_tmp: bool = False, region_coords: Iterable[tuple[str, int, int]] = (), region_primers: Iterable[tuple[str, DNA, DNA]] = (), primer_gap: int = 0, regions_file: str | None = None, count_del: bool = True, count_ins: bool = True, no_mut: Iterable[str] = (), only_mut: Iterable[str] = (), probe: str = 'DMS', mask_a: bool | None = None, mask_c: bool | None = None, mask_g: bool | None = None, mask_u: bool | None = None, mask_polya: int | None = None, mask_pos: Iterable[tuple[str, int]] = (), mask_pos_file: Iterable[str | Path] = (), drop_read: Iterable[str] = (), drop_read_file: Iterable[str | Path] = (), drop_discontig: bool = True, min_ninfo_pos: int = 1000, max_fmut_pos: float = 1.0, min_ncov_read: int = 1, min_fcov_read: float = 0.0, min_finfo_read: float = 0.95, max_fmut_read: float = 1.0, min_mut_gap: int | None = None, mut_collisions: str = 'auto', quick_unbias: bool = True, quick_unbias_thresh: float = 0.001, max_filter_iter: int = 0, filter_pos_table: bool = True, filter_read_table: bool = True, brotli_level: int = 10, self_contained: bool = False, num_cpus: int = 4, force: bool = False) list[Path]
Define mutations and regions to filter reads and positions.
- Parameters:
branch (
str) – Create a new branch of the workflow with this name [keyword-only, default: ‘’]tmp_pfx (
str | pathlib._local.Path) – Write all temporary files to a directory with this prefix [keyword-only, default: ‘./tmp’]keep_tmp (
bool) – Keep temporary files after finishing [keyword-only, default: False]region_coords (
Iterable) – Select a region of a reference given its 5’ and 3’ end coordinates [keyword-only, default: ()]region_primers (
Iterable) – Select a region of a reference given its forward and reverse primers [keyword-only, default: ()]primer_gap (
int) – Leave a gap of this many bases between the primer and the region [keyword-only, default: 0]regions_file (
str | None) – Select regions of references from coordinates/primers in a CSV file [keyword-only, default: None]count_del (
bool) – Count deletions as mutations [keyword-only, default: True]count_ins (
bool) – Count insertions as mutations [keyword-only, default: True]no_mut (
Iterable) – Do not count this type of mutation (overrides –count-del/ins) [keyword-only, default: ()]only_mut (
Iterable) – Count only this type of mutation (overrides other mutation settings) [keyword-only, default: ()]probe (
str) – Use the default options for this chemical probe [keyword-only, default: ‘DMS’]mask_a (
bool | None) – Mask positions with base A [keyword-only, default: None]mask_c (
bool | None) – Mask positions with base C [keyword-only, default: None]mask_g (
bool | None) – Mask positions with base G [keyword-only, default: None]mask_u (
bool | None) – Mask positions with base U [keyword-only, default: None]mask_polya (
int | None) – Mask stretches of at least this many consecutive A bases (0 disables); defaults to 5 for chemical probes, 0 for none [keyword-only, default: None]mask_pos (
Iterable) – Mask this position in this reference [keyword-only, default: ()]mask_pos_file (
Iterable) – Mask positions in references from a file [keyword-only, default: ()]drop_read (
Iterable) – Drop the read with this name [keyword-only, default: ()]drop_read_file (
Iterable) – Drop the reads with names in this file [keyword-only, default: ()]drop_discontig (
bool) – Drop paired-end reads with discontiguous mates [keyword-only, default: True]min_ninfo_pos (
int) – Mask positions with fewer than this many informative base calls [keyword-only, default: 1000]max_fmut_pos (
float) – Mask positions with more than this fraction of mutated base calls [keyword-only, default: 1.0]min_ncov_read (
int) – Drop reads with fewer than this many bases covering the region [keyword-only, default: 1]min_fcov_read (
float) – Drop reads covering less than this fraction of the region [keyword-only, default: 0.0]min_finfo_read (
float) – Drop reads with less than this fraction of informative base calls [keyword-only, default: 0.95]max_fmut_read (
float) – Drop reads with more than this fraction of mutated base calls [keyword-only, default: 1.0]min_mut_gap (
int | None) – Filter out mutations separated by fewer than this many bases [keyword-only, default: None]mut_collisions (
str) – If two mutations are closer than –min-mut-gap positions, MERGE the mutations, DROP the read, or AUTO-select based on the probe. [keyword-only, default: ‘auto’]quick_unbias (
bool) – Correct observer bias using a quick (typically linear time) heuristic [keyword-only, default: True]quick_unbias_thresh (
float) – Treat mutated fractions under this threshold as 0 with –quick-unbias [keyword-only, default: 0.001]max_filter_iter (
int) – Stop the filter step after this many iterations (0 for no limit) [keyword-only, default: 0]filter_pos_table (
bool) – Tabulate relationships per position for filter data [keyword-only, default: True]filter_read_table (
bool) – Tabulate relationships per read for filter data [keyword-only, default: True]brotli_level (
int) – Compress pickle files with this level of Brotli (0 - 11) [keyword-only, default: 10]self_contained (
bool) – Write self-contained batch files that do not require loading predecessor batches (Filter and Cluster steps), at the cost of larger files on disk [keyword-only, default: False]num_cpus (
int) – Use up to this many CPUs simultaneously [keyword-only, default: 4]force (
bool) – Force all tasks to run, overwriting any existing output files [keyword-only, default: False]
- seismicrna.filter.main.set_mask_acgu(probe: str, mask_a: bool | None = None, mask_c: bool | None = None, mask_g: bool | None = None, mask_u: bool | None = None)
Resolve per-base masking flags based on the probe type.
- Parameters:
probe (
str) – Probe type (one of the values inPROBES), used to set defaults when a flag is None.mask_a (
boolorNone, optional) – Whether to mask adenine positions; if None, inferred fromprobe.mask_c (
boolorNone, optional) – Whether to mask cytosine positions; if None, inferred fromprobe.mask_g (
boolorNone, optional) – Whether to mask guanine positions; if None, inferred fromprobe.mask_u (
boolorNone, optional) – Whether to mask uracil/thymine positions; if None, inferred fromprobe.
- Returns:
Resolved
(mask_a, mask_c, mask_g, mask_u)flags.- Return type:
- seismicrna.filter.main.set_mask_polya(probe: str, mask_polya: int | None = None)
Resolve poly(A) masking threshold based on the probe type.
- seismicrna.filter.main.set_mut_gap_params(probe: str, min_mut_gap: int | None = None, mut_collisions: str = 'auto')
Resolve mutation-gap and collision parameters based on the probe type.
- Parameters:
probe (
str) – Probe type (one of the values inPROBES), used to set defaults when a parameter isNone/MUT_COLLISIONS_AUTO.min_mut_gap (
intorNone, optional) – Minimum gap (in nucleotides) between two mutations in the same read; if None, a probe-specific default is used.mut_collisions (
str, optional) – How to handle reads with mutations closer thanmin_mut_gap; ifMUT_COLLISIONS_AUTO, a probe-specific default is used.
- Returns:
Resolved
(min_mut_gap, mut_collisions)values.- Return type:
tuple[int,str]
- class seismicrna.filter.report.BaseFilterReport(**kwargs: Any | Callable[[Report], Any])
Bases:
RegReport,FilterIO,ABC- classmethod get_file_seg_type()
Type of the last segment in the path.
- class seismicrna.filter.report.FilterReport(**kwargs: Any | Callable[[Report], Any])
Bases:
BatchedReport,BaseFilterReport- classmethod get_param_report_fields()
Parameter fields of the report.
- classmethod get_result_report_fields()
Result fields of the report.
- class seismicrna.filter.report.JoinFilterReport(**kwargs: Any | Callable[[Report], Any])
Bases:
JoinReport,BaseFilterReport- classmethod get_param_report_fields()
Parameter fields of the report.
- class seismicrna.filter.table.FilterBatchTabulator(*, get_batch_count_all: Callable, num_batches: int, num_cpus: int = 1, **kwargs)
Bases:
BatchTabulator,FilterTabulator
- class seismicrna.filter.table.FilterCountTabulator(*, batch_counts: Iterable[tuple[Any, Any, Any, Any]], **kwargs)
Bases:
CountTabulator,FilterTabulator
- class seismicrna.filter.table.FilterDatasetTabulator(*, dataset: MutsDataset, validate: bool = False, **kwargs)
- class seismicrna.filter.table.FilterPositionTable
Bases:
FilterTable,PartialPositionTable,ABC
- class seismicrna.filter.table.FilterReadTable
Bases:
FilterTable,PartialReadTable,ABC
- class seismicrna.filter.table.FilterReadTableLoader(table_file: str | Path, **kwargs)
Bases:
ReadTableLoader,FilterReadTable
- class seismicrna.filter.table.FilterReadTableWriter(tabulator: Tabulator)
Bases:
ReadTableWriter,FilterReadTable
- class seismicrna.filter.table.FilterTable
Bases:
AverageTable,FilterFile,ABC- classmethod get_load_function()
LoadFunction for all Dataset types for this Table.
- class seismicrna.filter.table.FilterTabulator(*, refseq: DNA, region: Region, pattern: RelPattern, min_mut_gap: int, mut_collisions: str, quick_unbias: bool, quick_unbias_thresh: float, count_ends: bool = True, **kwargs)
Bases:
PartialTabulator,AverageTabulator,ABC- classmethod table_types()
Types of tables that this tabulator can write.
- class seismicrna.filter.table.PartialDatasetTabulator(*, dataset: MutsDataset, validate: bool = False, **kwargs)
Bases:
DatasetTabulator,PartialTabulator,ABC- classmethod init_kws()
Attributes of the dataset to use as keyword arguments in super().__init__().
- class seismicrna.filter.table.PartialPositionTable
Bases:
PartialTable,PositionTable,ABC
- class seismicrna.filter.table.PartialReadTable
Bases:
PartialTable,ReadTable,ABC
- class seismicrna.filter.table.PartialTable
Bases:
Table,HasRegFilePath,ABCTable of filtered reads over a region of the sequence.
- class seismicrna.filter.table.PartialTabulator(*, refseq: DNA, region: Region, pattern: RelPattern, min_mut_gap: int, mut_collisions: str, quick_unbias: bool, quick_unbias_thresh: float, count_ends: bool = True, **kwargs)
-
- property correct_bias
Whether to correct for observer bias.
- property data_per_pos
DataFrame of per-position data.
- classmethod get_null_value()
The null value for a count: either 0 or NaN.
- property p_ends_given_clust_noclose
Probability of each end coordinate.
- seismicrna.filter.table.adjust_counts(table_per_pos: pd.DataFrame, p_ends_given_clust_noclose: np.ndarray, n_reads_clust: pd.Series | int, region: Region, min_mut_gap: int, mut_collisions: str, quick_unbias: bool, quick_unbias_thresh: float)
Adjust the given table of Filtered/Clustered counts per position to correct for observer bias.
- class seismicrna.filter.write.Filterer(dataset: IDmutMutsDataset | PoolMutsDataset, region: Region, pattern: RelPattern, *, max_filter_iter: int, mask_polya: int, mask_a: bool, mask_c: bool, mask_g: bool, mask_u: bool, mask_pos: list[tuple[str, int]], mask_pos_file: list[Path], drop_read: list[str], drop_read_file: list[Path], drop_discontig: bool, min_ncov_read: int, min_fcov_read: float, min_finfo_read: float, max_fmut_read: float, min_mut_gap: int, mut_collisions: str, probe: str, min_ninfo_pos: int, max_fmut_pos: float, quick_unbias: bool, quick_unbias_thresh: float, count_read: bool, brotli_level: int, top: Path, branch: str, self_contained: bool, num_cpus: int = 1)
Bases:
objectFilter batches of relationships.
- CHECKSUM_KEY = 'filter'
- DROP_READ_DISCONTIG = 'read-discontig'
- DROP_READ_FCOV = 'read-fcov'
- DROP_READ_FINFO = 'read-finfo'
- DROP_READ_FMUT = 'read-fmut'
- DROP_READ_GAP = 'read-gap'
- DROP_READ_INIT = 'read-init'
- DROP_READ_KEPT = 'read-kept'
- DROP_READ_LIST = 'read-exclude'
- DROP_READ_NCOV = 'read-ncov'
- MASK_POS_FMUT = 'pos-fmut'
- MASK_POS_NINFO = 'pos-ninfo'
- PATTERN_KEY = 'pattern'
- create_report()
- property n_reads_discontig
- property n_reads_init
- property n_reads_kept
Number of reads kept.
- property n_reads_list
- property n_reads_max_fmut
- property n_reads_min_fcov
- property n_reads_min_finfo
- property n_reads_min_gap
- property n_reads_min_ncov
- property pos_a
Positions masked for having base A.
- property pos_c
Positions masked for having base C.
- property pos_g
Positions masked for having base G.
- property pos_kept
Positions kept.
- property pos_list
Positions masked arbitrarily from a list.
- property pos_max_fmut
Positions masked for having too many mutations.
- property pos_min_ninfo
Positions masked for having too few informative reads.
- property pos_n
Positions masked for having base N.
- property pos_polya
Positions masked for lying in a poly(A) sequence.
- property pos_u
Positions masked for having base T or U.
- property read_names_dataset
Dataset of the read names.
- run_filtering()
- seismicrna.filter.write.filter_region(dataset: IDmutMutsDataset | PoolMutsDataset, region: Region, *, branch: str, count_del: bool, count_ins: bool, no_mut: Iterable[str], only_mut: Iterable[str], filter_pos_table: bool, filter_read_table: bool, self_contained: bool, force: bool, num_cpus: int, tmp_pfx, keep_tmp, **kwargs)
Filter reads, positions, and relationships in a dataset.
- seismicrna.filter.write.list_mask_pos(ref: str, mask_pos: Iterable[tuple[str, int]], mask_pos_file: Iterable[str | Path], end5: int | None = None, end3: int | None = None)
List the positions to mask for one reference.
Combine the positions given directly with those loaded from files, keeping only the positions for the given reference. If
end5andend3are given, keep only positions within[end5, end3]. Return a sorted array of unique positions.