mgkit.snps.filter module¶
SNPs filtering functions
-
mgkit.snps.filter.
filter_genesyn_by_coverage
(gene_syn, min_cov=None)[source]¶ Checks if the coverage of the provided gene_syn is at least min_cov
- Parameters
gene_syn –
GeneSyn
instancemin_cov (int) – minimum coverage allowed (included)
- Returns
True if the gene has enough coverage
- Return type
- Raises
FilterFails – if min_cov is None
-
mgkit.snps.filter.
filter_genesyn_by_gene_id
(gene_syn, gene_ids=None, exclude=False, id_func=None)[source]¶ Checks if the gene_id is listed in the filter_list.
- Parameters
gene_syn –
GeneSyn
instancegene_ids (iterable) – list of gene IDs to include/exclude
exclude (bool) – if the filter is reversed
- Returns
if the exclude is True, the gene_id must appear in the gene_ids, if False, returns True only if gene_id is NOT in gene_ids.
- Return type
- Raises
FilterFails – if gene_ids is None
-
mgkit.snps.filter.
filter_genesyn_by_taxon_id
(gene_syn, taxonomy=None, filter_list=None, exclude=False, func=None)[source]¶ Checks if the taxon_id attribute of gene_syn is the filter_list. Exclude reverses the result. If func is supplied, it’s used to traverse the taxonomy.
- Parameters
gene_syn –
GeneSyn
instancetaxonomy – a valid taxonomy (instance of
Taxonomy
)filter_list (iterable) – list of taxon IDs to include/exclude
exclude (bool) – if the filter is reversed
func (func) –
is_ancestor()
- Returns
if the exclude is True, the gene_id must appear in the gene_ids, if False, returns True only if gene_id is NOT in gene_ids.
- Return type
- Raises
FilterFails – if filter_list is None or taxonomy is None and func is not None
-
mgkit.snps.filter.
get_default_filters
(taxonomy, **kwargs)[source]¶ Retuns a list of filters that are used by default. it needs a valid taxonomy and gets the default arguments from
mgkit.consts.DEFAULT_SNP_FILTER
.