run_method reference

run_method is the single entry point for the whole pipeline. Whatever you give it — a CSV path, a .jld2 path, or in-memory strings + labels — it runs the same five steps: load → (optionally) tune → train → attribute → render.

This page lists every argument it accepts, grouped by what it controls, with defaults and plain-English meanings. Jump to Recipes if you just want something to copy.

The four ways to call it

using MotifInference

# 1. A two-column CSV: `sequence, measurement` (header auto-detected)
run_method("data/mydata.csv")

# 2. A .jld2 file containing a SEQ2EXP_Dataset as `raw_data`
run_method("data/mydata.jld2")

# 3. In memory — no file needed
run_method(strings, labels)                 # strings::Vector{String}, labels::Vector

# 4. A registered dataset entry
run_method(load_datasets("ecoli")[1])

All four accept the same keyword arguments below.

When does tuning happen?

Hyperparameter tuning runs only when seed === nothing (the default). Pass seed=<n> to reuse a known-good model and skip tuning entirely. The tune_* arguments have no effect once a seed is given.


1. Data & model

How your sequences are interpreted and which model is built.

ArgumentDefaultMeaning
seq_type:dna:dna or :rna.
normalization_method:zscoreHow labels are normalized before training: :zscore, :identity, :log, …
multioutputfalseSet true when labels has multiple columns (multi-output model).
conv_bottleneckfalseUse a bottleneck conv layer (squeezes the inference-code conv layer; needs sequences ≳ 25 nt).
feature_namesnothingColumn names for multi-output labels (used to label per-output result folders).

2. Reproducibility & tuning

seed decides whether tuning runs at all; the tune_* knobs control how long it takes when it does.

ArgumentDefaultMeaning
seednothingRNG seed. nothing → run hyperparameter tuning and pick the best seed. An Int → skip tuning, train directly with that seed.
tune_n_trials25Number of candidate models tried during tuning. Lower this (e.g. 3) for a quick run.
tune_max_epochs25Max training epochs per tuning trial.
tune_patience5Early-stopping patience (epochs with no improvement) during tuning.

Want tuning to finish fast? The single biggest lever is tune_n_trials — it is the "how many models" count. tune_n_trials=3 tries 3 models instead of 25.


What the attribution step looks for.

ArgumentDefaultMeaning
motif_sizes[2, 3, 4, 5]Multi-motif group sizes to search. Always starts at 2 (pairs); [2,3] searches pairs and triples, etc.
activation_thresh0.9Percentile threshold for treating a motif as "active" in a sequence.

4. Output selection & rendering

Which outputs get processed and how the HTML report is labeled.

ArgumentDefaultMeaning
output_indicesnothingWhich output columns to process. nothing → all outputs (when the model predicts all positions), otherwise the first. Pass e.g. 1:5 or [2].
sensitivity_analysisfalseRun sensitivity analysis in the conv-case rendering.
dataset_namenothingName shown in the rendered report.
show_outside_mutationstrueMutagenesis runs (type=:mut) only. Also draw, per motif, the mutations its sequences carry outside the motif's filter windows: every outside site where more than 2% of the motif's sequences are mutated becomes an extra logo column (wild type grey, mutants orange) in <f>_ow.png / <f>_altview_ow.png, and the pages get a Show/Hide switch. false gives the output from before the option existed.

5. Where results are saved

ArgumentDefaultMeaning
save_root"."Parent directory in which the results folder is created.
save_folder_namenothingExact results-folder name. Overrides the CSV/dataset name.
nameCSV basename / "inmemory"Fallback folder name when save_folder_name is unset (mainly for the in-memory call).

Final results path: joinpath(save_root, save_folder_name_or_name)/.


6. Advanced (trc-only)

A handful of knobs are not exposed as run_method keyword arguments. To change them, build a training_and_rendering_config yourself and call run_method(trc):

FieldDefaultMeaning
loss_spec:mseLoss + aggregation; also :mae, :huber, :binary_cross_entropy.
max_training_epochs40Max epochs for final model training.
max_processor_epochs60Max epochs for processor training.
predict_position:all:all or an integer output index.
patience10Early-stopping patience for final training.
scale_backtrueUndo normalization before Banzhaf-index calculations.
top_and_bot_counts8Number of top/bottom significant motifs to render.
count_threshold25Minimum count for a motif to be considered.
Q_threshold1e-25Q-value threshold for significance filtering.
dpi60Resolution of rendered plots.
trc = MotifInference.training_and_rendering_config(
    "data/mydata.jld2", model_creator, "results/run01", "My title";
    seq_type=:dna, loss_spec=MotifInference.loss_specs[:huber], dpi=120)
run_method(trc)

Recipes

# Quick run — only 3 candidate models instead of the default 25
run_method("data/mydata.csv"; tune_n_trials=3)

# RNA with a fixed seed → no tuning at all (fastest)
run_method("data/utr.csv"; seq_type=:rna, seed=42)

# DNA, search only pairs and triples, write results elsewhere
run_method("data/mydata.csv"; motif_sizes=[2, 3], save_root="/scratch/results")

# Multi-output DNA, process just the first five outputs
run_method("data/multi.jld2"; multioutput=true, output_indices=1:5)

# In-memory, no file on disk
run_method(strings, labels; seq_type=:dna)

Valid symbol values at a glance

KeywordAccepts
seq_type:dna, :rna
normalization_method:zscore, :identity, :log, …
loss_spec (trc-only):mse, :mae, :huber, :binary_cross_entropy