grelu.interpret.modisco#

Functions#

_add_tomtom_to_modisco_report(→ None)

Modified from jmschrei/tfmodisco-lite

run_modisco(→ None)

Run TF-Modisco to get relevant motifs for a set of inputs, and optionally score the

Module Contents#

grelu.interpret.modisco._add_tomtom_to_modisco_report(modisco_dir: str, tomtom_results: pandas.DataFrame, meme_file: str, top_n_matches: int) None[source]#

Modified from jmschrei/tfmodisco-lite

grelu.interpret.modisco.run_modisco(model, seqs: pandas.DataFrame | numpy.array | List[str], genome: str | None = None, prediction_transform: Callable | None = None, window: int = None, meme_file: str = None, out_dir: str = 'outputs', devices: str | int = 'cpu', num_workers: int = 1, batch_size: int = 64, n_shuffles: int = 10, seed=None, method: str = 'deepshap', **kwargs) None[source]#

Run TF-Modisco to get relevant motifs for a set of inputs, and optionally score the motifs against a reference set of motifs using TOMTOM

Parameters:
  • model – A trained deep learning model

  • seqs – Input DNA sequences as genomic intervals, strings, or integer-encoded form.

  • genome – Name of the genome to use. Only used if genomic intervals are provided.

  • prediction_transform – A module to transform the model output

  • window – Sequence length over which to consider attributions

  • meme_file – Path to a MEME file containing reference motifs for TOMTOM.

  • out_dir – Output directory

  • devices – Indices of devices to use for model inference

  • num_workers – Number of workers to use for model inference

  • batch_size – Batch size to use for model inference

  • n_shuffles – Number of times to shuffle the background sequences for deepshap.

  • seed – Random seed

  • method – Either “deepshap”, “saliency” or “ism”.

  • **kwargs – Additional arguments to pass to TF-Modisco.

Raises:

NotImplementedError – if the method is neither “deepshap” nor “ism”