-
Notifications
You must be signed in to change notification settings - Fork 0
Extending
How to add a new profiler, dataset, or metric to the pipeline. The design goal is that each addition touches a small, predictable set of places.
-
Execution - add a branch in
scripts/process/process.sh(andprocess_sr.shif it handles short reads) that runs the tool against--db-dir's index and writes into<out>/<project>/<tech>/<Tool>-results/. -
Post-processing - if the tool's native output isn't directly parseable, add a converter (mirroring
generate_kreport.sh/ganon_report.sh/sylph-tax.sh) and wire it intopostprocess.sh. -
Parser - write
parse_<tool>_...inscripts/analysis/utils/parser.pyreturning the standardized schema (see below). -
Registry - register the tool in
analysis_prep.py_build_registries(), in both thedetectionandabundancedicts. Each entry needs:"<Tool>": { "parser": <your_parse_fn>, "patterns": ["*_report.tsv"], # glob(s) for the report file "exclude": [], # globs to skip "kwargs": {}, # extra parser kwargs "needs_ncbi": True, # True if the parser takes an ete3 handle "rank_labels": {"species": "S", "genus": "G"}, # if kreport-style "subdir": "<Tool>-results", # report subdir under the tech dir }
-
Taxonomy (only if
needs_ncbi) - if the tool emits names or non-NCBI lineages, add its ete3 snapshot path toETE3_SUBPATHSand map each(Tool, db)pair to a snapshot inNCBI_FOR_TOOL_DB. Tools that emit native NCBI taxids setneeds_ncbi: Falseand skip this. See Tools and Databases. -
Default DB - document its provenance; if rebuilding the unified index, add the tool to Database Build.
Every parser returns a DataFrame with (at least) the unified columns the downstream notebooks expect:
taxid_raw, taxid, name_raw, name, rank, value, value_type,
abundance_raw, ...tool-specific extras...
taxid/name are the cleaned values; value is the standardized numeric field that detection/abundance scoring reads. Column semantics per existing tool are catalogued in scripts/analysis/utils/output_format_notes.txt.
-
Reads - place fastqs under
data/<data_group>/<technology>/<sample>.fastq(the.../<data_group>/<technology>/<sample>shape is required so the driver can derive the output layout). -
Manifest - add
data/datasets_<name>.txt, one fastq path per line (#-comments + blanks allowed). Pass it via--dataset-list. -
Ground truth (if known) - drop the truth CSV anywhere under
--data-root(defaultdata/) and add a row todata/ground_truth/registry.csv:label,relpath,sep,name_col,abund_col <label>,<relpath-from-data-root>,",",<name-col>,<abund-col>
Example existing rows:
zymoD6331,ZymoMockD6331/zymoD6331_gt.csv,",",name,abundance simulated_pacbio,simulated/pacbio/simulated_pacbio_gt.csv,",",name,abundance
analysis_prep.pydiscovers truth sources from the registry and writes a normalized<label>_gt.csvunderresults/metadata/<ts>/analysis-prep/ground_truth/. If the dataset has no truth (clinical-style), skip this step - it's then analyzed by cross-tool agreement only. -
Data-group filter - if the new dataset lives under a
<data_group>directory that isn'tZymoMockD6331orsimulated, either pass it explicitly via--data-groups <csv>topostprocess.sh/analysis_prep.py, or add it to the default list inside those scripts. The DYN cohort is opt-in via the same flag (default skips it becausedyn_prep.pyis the preferred path for DYN). -
Notebook selection - add the dataset key to the
DATASETSdict in the relevant figure notebook's config cell, with both aSAMPLE_LABEL(raw sample name used to look up the prep output on disk) and aDISPLAY_TITLE(human-readable label shown in figure titles). Select it viaDATASETat the top of the notebook.
Slot it into the detection or abundance notebook next to the existing metrics, and write a per-rank summary CSV - mirror the JSD-summary pattern in analysis_abundance.ipynb (compute per (tool, rank), reorder by ORDER_TOOLDB, write *_<metric>_summary.csv). See Analysis Methods for the existing set.
-
CLI flags are consistent across the shell drivers:
--db,--out,--db-dir,--report,--dataset/--dataset-list,--data-groups,--techs,--jobs,--threads,--tools,--samples. -
--data-groups <csv>is the standard "which top-level project dirs to walk" filter acrosspostprocess.sh(and its three sub-scripts),analysis_prep.py, anddyn_prep.py. Default isZymoMockD6331,simulated; DYN is opt-in. -
Parallelism -
--jobs Nin the post-processors andanalysis_prep.py;--threads Nfor the profilers anddyn_prep.py. Both prep scripts run a CPU + memory safety check during--dry-run. -
Timestamped output dirs -
analysis_prep.pyanddyn_prep.pyeach create a freshresults/metadata/<YYYYMMDD_HHMMSS>/<script>-prep/per run; notebooks pick the latest viafind_latest_*_ts()inutils/results.py. Don't read/write through hardcoded paths - go through the helpers so a new run automatically becomes the default. -
--dry-runis supported on both prep scripts and writes its manifest under the fixedresults/metadata/dry-run/<script>-prep/path (overwrites on rerun, so dry-runs never clutter the timestamp history). -
Notebook
SAVEknob + helpers - every figure notebook has aSAVE = True/Falseswitch at the top. Usesave_csv/save_fig/save_iffromutils/results.pyfor new save sites so they respect that knob and write under the consistentresults/<ts>/<analysis>/...tree. -
Sample naming -
analysis_prep.pypreserves raw dataset prefixes in its output filenames; downstream notebooks should look up bySAMPLE_LABEL(the raw on-disk name) and only useDISPLAY_TITLEfor figure-facing strings. Don't strip prefixes inside the notebook. -
ete3 is not picklable -
analysis_prep.pyanddyn_prep.pybuild oneNCBIRegistryper worker; keep new parsers compatible with that (take the ncbi handle as an argument, don't hold a module-global).
- Pipeline Overview - where each stage lives
- Analysis Methods - the scoring functions a new metric joins