Skip to content

Command Line Interface

Ali Altintas edited this page Aug 26, 2026 · 1 revision

Command-Line Interface

A thin CLI wraps the setup steps in Configuration Reference so you don't have to assemble input/config.yaml and input/samples.csv by hand — it creates the same two gitignored files and then launches snakemake, so the workflow itself is unchanged. Run it with the project's Python (the env ships PyYAML):

python workflow/scripts/tetranscripts-pipe --version   # echoes the release from VERSION
python workflow/scripts/tetranscripts-pipe --help      # lists the subcommands

Three subcommands:

  • init — copies config/config.example.yaml and config/samples.example.csv into input/ (refuses to overwrite unless --force). Same as the manual cp steps in Configuration Reference, for starting a fresh analysis.

  • samples --reads DIR — scans a fastq directory (recursively) and writes a schema-valid input/samples.csv. _R1/_R2 (or _1/_2) files pair up; a lone _R1 is written as single-end; unmarked files become single-end rows; _L00N lanes and _001 chunks collapse into repeated rows for the same sample — exactly the nf-core lane merging the workflow's cat_fastq step expects. It fails loudly on R2-without-R1 and on mixed paired/single-end lanes for one sample. --dry-run prints the sheet to stdout instead of writing it.

  • run — generates input/config.yaml from the example template when missing (with --fasta/--gtf/--te-gtf filling in the reference paths) and the sample sheet from --reads when missing, then runs snakemake:

    python workflow/scripts/tetranscripts-pipe run \
      --reads /data/fastq \
      --fasta /refs/genome.fa --gtf /refs/genome.gtf --te-gtf /refs/TE_curated.gtf \
      --cores 32
    
    python workflow/scripts/tetranscripts-pipe run --dry-run --reads /data/fastq   # just print the plan
    python workflow/scripts/tetranscripts-pipe run --profile workflow/profiles/slurm --cores 64

    An existing input/config.yaml/input/samples.csv is used as-is, so your hand-edits survive; --force regenerates them. --profile (e.g. the bundled workflow/profiles/slurm), --cores, --snakemake-args and --keep-temp are passed through to snakemake.

    Once your config exists and already points at a sample sheet (its samples: key), no other options are needed — run reads the sheet path straight from the config (resolved repo-root-relative, exactly like snakemake does):

    python workflow/scripts/tetranscripts-pipe run --config input/config.yaml --cores 32

    Relative paths inside a config always resolve against the repo checkout that contains the config (its workflow/Snakefile ancestor), and snakemake is launched from that same root. So the CLI can be installed in a different checkout than the analysis — e.g. a shared apps/ copy running a config in an analysis working copy:

    python /software/TEtranscripts-pipe/workflow/scripts/tetranscripts-pipe \
      run --config /data/projects/rnaseq/TEtranscripts-pipe/input/config.yaml --cores 32

    --samplesheet still takes precedence for the CLI's own existence check, but with an existing config snakemake always reads the config's samples: path — the flag is authoritative only when the config is scaffolded (or regenerated with --force).

Clone this wiki locally