grelu.io.motifs#
Functions related to reading and writing MEME files
Functions#
|
Read a motif database in MEME format |
|
Reads motifs discovered by TF-MoDISco |
|
Retrieve motifs from the JASPAR database (https://jaspar.elixir.no/) |
Module Contents#
- grelu.io.motifs.read_meme_file(file: str, names: List[str] | None = None, n_motifs: int | None = None) Dict[str, numpy.ndarray] [source]#
Read a motif database in MEME format
- Parameters:
file – The path to the MEME file
names – List of motif names to read
n_motifs – Number of motifs to read
- Returns:
a dictionary in which the keys are motif names and the values are the motif position probability matrices (PPMs) as numpy arrays of shape (4, L).
- grelu.io.motifs.read_modisco_report(h5_file: str, group: str | None = None, names: List[str] | None = None, trim_threshold: float = 0.3) Dict[str, numpy.ndarray] [source]#
Reads motifs discovered by TF-MoDISco
- Parameters:
h5_file – Path to an h5 file containing modisco output
group – One of “pos” for positive motifs, “neg” for negative motifs or None for all motifs.
names – A list containing names of motifs to read. Overrides ‘group’.
trim_threshold – A threshold value between 0 and 1 used for trimming the PPMs. Each PPM will be trimmed from both ends until the first position for which the probability for any base is greater than or equal to trim_threshold. trim_threshold = 0 will result in no trimming.
- Returns:
a dictionary in which the keys are motif names and the values are the motif position probability matrices (PPMs) as numpy arrays of shape (4, L).
- Return type:
motifs
- grelu.io.motifs.get_jaspar(release: str = 'JASPAR2024', collection: str = 'CORE', tax_group: str | None = None, species: str | None = None, **kwargs) Dict[str, numpy.ndarray] [source]#
Retrieve motifs from the JASPAR database (https://jaspar.elixir.no/)
- Parameters:
release – Only motifs from the specified JASPAR release are returned.
collection – Only motifs from the specified JASPAR collection(s) are returned.
tax_group – Only motifs belonging to the given taxonomic supergroups are returned.
species – Only motifs derived from the given species are returned. Species are specified as taxonomy IDs.
**kwargs – Additional arguments to pass to jdb_obj.fetch_motifs.
- Returns:
a dictionary in which the keys are motif names and the values are the motif position probability matrices (PPMs) as numpy arrays of shape (4, L).