homerun-csRNA 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. homerun_csrna-1.0.0/LICENSE +21 -0
  2. homerun_csrna-1.0.0/PKG-INFO +385 -0
  3. homerun_csrna-1.0.0/README.md +332 -0
  4. homerun_csrna-1.0.0/pyproject.toml +59 -0
  5. homerun_csrna-1.0.0/setup.cfg +4 -0
  6. homerun_csrna-1.0.0/src/homerun/__init__.py +2 -0
  7. homerun_csrna-1.0.0/src/homerun/__main__.py +3 -0
  8. homerun_csrna-1.0.0/src/homerun/bedgraphs.py +79 -0
  9. homerun_csrna-1.0.0/src/homerun/config.py +232 -0
  10. homerun_csrna-1.0.0/src/homerun/mapping.py +160 -0
  11. homerun_csrna-1.0.0/src/homerun/pipeline.py +703 -0
  12. homerun_csrna-1.0.0/src/homerun/prepare.py +282 -0
  13. homerun_csrna-1.0.0/src/homerun/qc.py +906 -0
  14. homerun_csrna-1.0.0/src/homerun/report.py +557 -0
  15. homerun_csrna-1.0.0/src/homerun/ritrie.py +255 -0
  16. homerun_csrna-1.0.0/src/homerun/stability.py +166 -0
  17. homerun_csrna-1.0.0/src/homerun/tagdirs.py +144 -0
  18. homerun_csrna-1.0.0/src/homerun/trim.py +105 -0
  19. homerun_csrna-1.0.0/src/homerun/tss.py +56 -0
  20. homerun_csrna-1.0.0/src/homerun/utils.py +337 -0
  21. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/PKG-INFO +385 -0
  22. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/SOURCES.txt +28 -0
  23. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/dependency_links.txt +1 -0
  24. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/entry_points.txt +2 -0
  25. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/requires.txt +8 -0
  26. homerun_csrna-1.0.0/src/homerun_csRNA.egg-info/top_level.txt +1 -0
  27. homerun_csrna-1.0.0/tests/test_cli.py +195 -0
  28. homerun_csrna-1.0.0/tests/test_config.py +160 -0
  29. homerun_csrna-1.0.0/tests/test_package.py +56 -0
  30. homerun_csrna-1.0.0/tests/test_sample_parsing.py +229 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Thomas Nguyen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: homerun-csRNA
3
+ Version: 1.0.0
4
+ Summary: CSV-free csRNA-seq pipeline (trim → STAR → tag dirs → bedGraphs → TSS → QC → stability)
5
+ Author: Thomas Nguyen
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Thomas Nguyen
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://thomasmnguyen.dev/homerun/
29
+ Project-URL: Repository, https://github.com/NguyenThomas986/homerun
30
+ Project-URL: Issues, https://github.com/NguyenThomas986/homerun/issues
31
+ Keywords: rna-seq,csrna-seq,slurm,hpc,bioinformatics,pipeline,transcription-initiation
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Science/Research
34
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: POSIX :: Linux
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Requires-Python: >=3.9
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: pandas>=2.0
46
+ Requires-Dist: numpy>=1.24
47
+ Requires-Dist: matplotlib>=3.7
48
+ Requires-Dist: seaborn>=0.12
49
+ Requires-Dist: reportlab>=4.0
50
+ Provides-Extra: test
51
+ Requires-Dist: pytest>=8.0; extra == "test"
52
+ Dynamic: license-file
53
+
54
+ # homerun
55
+
56
+ <div align="center">
57
+
58
+ [![CI](https://github.com/NguyenThomas986/homerun/actions/workflows/ci.yml/badge.svg)](https://github.com/NguyenThomas986/homerun/actions/workflows/ci.yml)
59
+ [![Open Issues](https://img.shields.io/github/issues/NguyenThomas986/homerun.svg)](https://github.com/NguyenThomas986/homerun/issues)
60
+ [![Closed Issues](https://img.shields.io/github/issues-closed/NguyenThomas986/homerun.svg)](https://github.com/NguyenThomas986/homerun/issues?q=is%3Aissue+is%3Aclosed)
61
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
62
+
63
+ </div>
64
+
65
+ This repository is the SLURM-oriented wrapper around the Python package in [csrnaseq](csrnaseq). It is meant to help you launch a complete csRNA-seq analysis workflow from a project directory on a cluster.
66
+
67
+ ## What this repo contains
68
+
69
+ - [submit_array.sh](submit_array.sh): submits the full 7-phase workflow
70
+ - [prepare.sbatch](prepare.sbatch): prepares the project and runs the initial setup
71
+ - [align_array.sbatch](align_array.sbatch): runs trim + align for one leaf run per array task
72
+ - [tagdir_array.sbatch](tagdir_array.sbatch): builds leaf-level TagDirs in parallel, one array task per leaf
73
+ - [tagdirs_combo_array.sbatch](tagdirs_combo_array.sbatch): merges replicates into combo TagDirs in parallel, one array task per Species/Sample
74
+ - [tss_array.sbatch](tss_array.sbatch): calls TSRs with `findcsRNATSS.pl` in parallel, one array task per Species/Sample
75
+ - [bedgraphs_array.sbatch](bedgraphs_array.sbatch): builds bedGraphs in parallel, one array task per Species/Sample
76
+ - [collect.sbatch](collect.sbatch): runs `ritrie`, QC, stability, and reporting after every array phase finishes
77
+ - [csrnaseq](csrnaseq): the Python package that actually performs the pipeline steps
78
+
79
+ ## Project structure
80
+
81
+ Projects are organized as a nested `Species/Sample/Leaf` directory layout. Rather than writing outputs to shared top-level directories, each leaf run generates and keeps its own intermediate outputs alongside it, and each sample keeps its own combined/downstream outputs one level up.
82
+
83
+ Species and sample names are parsed straight out of the FASTQ filenames. For example, `homo_sapiens_K562_csRNA-r1_DB422_S1_R1_001.fastq.gz` and `homo_sapiens_K562_csRNA-r2_DB423_S2_R1_001.fastq.gz` become species `homo_sapiens`, sample `K562`, with leaves `csRNA_r1` and `csRNA_r2`. Each distinct assay/replicate combination becomes its own leaf directory, and paired-end reads (files sharing a leaf but differing only in `_R1`/`_R2`) are staged into that same leaf.
84
+
85
+ This produces a tree like:
86
+
87
+ homerun_test/
88
+ ├── config.txt # auto-generated summary of every run's config + samples
89
+ └── homo_sapiens/
90
+ └── K562/
91
+ ├── RNA_r1/ # paired-end (R1 + R2)
92
+ │ ├── RawData/
93
+ │ ├── Trimmed/
94
+ │ ├── Aligned/
95
+ │ └── TagDir/
96
+ ├── csRNA_r1/
97
+ │ ├── RawData/
98
+ │ ├── Trimmed/
99
+ │ ├── Aligned/
100
+ │ └── TagDir/
101
+ ├── csRNA_r2/
102
+ │ └── ...
103
+ ├── csRNA-combo/ # combined TagDir/bedGraph across csRNA_r1 + csRNA_r2
104
+ │ ├── TagDir/
105
+ │ └── bedGraph/
106
+ ├── sRNA_r1/
107
+ │ └── ...
108
+ ├── sRNA_r2/
109
+ │ └── ...
110
+ ├── sRNA-combo/
111
+ │ ├── TagDir/
112
+ │ └── bedGraph/
113
+ ├── TSS/ # called TSRs for this sample
114
+ ├── QC/ # QC plots, ritrie output, qc_report.html
115
+ └── QC/qc_report.html
116
+
117
+ - **Trimmed reads** are written into each leaf's local `Trimmed/` directory.
118
+ - **Alignments** are written into each leaf's local `Aligned/` directory.
119
+ - **Leaf-level TagDirs** are built inside each replicate leaf (e.g. `K562/csRNA_r1/TagDir/`).
120
+ - **Combined TagDirs/bedGraphs** are built as their own sibling directory per assay, named `<assay>-combo/` (e.g. `K562/csRNA-combo/`, `K562/sRNA-combo/`), merging that assay's replicate leaves.
121
+ - **TSS, QC, RITRIE, and reporting** are built within each sample's directory (e.g. `homo_sapiens/K562/`), downstream of the combo TagDirs.
122
+ - **Reporting** is simplified to a single `qc_report.html` per sample.
123
+ - **`config.txt`** at the project root records every config value used for the run (genome, aligner, thresholds, `--gtf`, etc.) and every sample/RawData file discovered — see [Run configuration (config.txt)](#run-configuration-configtxt) below.
124
+
125
+ ## Typical workflow
126
+
127
+ 1. Create a project directory and place your FASTQ files in it — they'll be parsed and staged into the nested `Species/Sample/Leaf` layout automatically (e.g. `homo_sapiens/K562/csRNA_r1/RawData/`).
128
+ 2. Run the submission script with the required paths and cluster settings.
129
+ 3. Let the prepare, align-array, tagdir/tagdirs-combo-array, tss/bedgraphs-array, and collect stages run in sequence (see dependency graph below).
130
+ 4. Inspect the outputs alongside each sample, especially `QC/qc_report.html` and the `TSS/` directory (e.g. `homo_sapiens/K562/QC/qc_report.html`), and check `config.txt` at the project root to confirm what the run was actually configured with.
131
+
132
+ ### Job-array dependency graph
133
+
134
+ ```
135
+ prepare
136
+ └─afterok─> align_array[0..N-1]
137
+ ├─afterok─> tagdir_array[0..N-1] (leaf TagDirs)
138
+ └─afterok─> tagdirs_combo_array[0..S-1] (combo TagDirs)
139
+ ├─afterok─> tss_array[0..S-1]
140
+ └─(+ tagdir_array)─afterok─> bedgraphs_array[0..S-1]
141
+ └─afterok─(+tss_array)─> collect
142
+ ```
143
+
144
+ - **N** = number of leaf runs (R1 files in RawData) — `align_array`/`tagdir_array` indexing, one task per leaf run.
145
+ - **S** = number of Species/Sample groups — `tagdirs_combo_array`/`bedgraphs_array`/`tss_array` indexing, one task per Species/Sample (usually smaller than N, since a sample typically has several leaf runs).
146
+
147
+ `tagdirs_combo_array` only needs `align_array` to finish (not `tagdir_array`), so it runs in parallel with the leaf TagDir build rather than after it — combo TagDirs are built straight from the aligned SAM files, not from the leaf TagDirs. `tss_array` needs the combo TagDirs. `bedgraphs_array` needs **both** `tagdir_array` and `tagdirs_combo_array`, since it builds bedGraphs for every TagDir (leaf and combo alike) under a sample. `collect` then runs `ritrie`, QC, stability, and reporting over everything the array phases built.
148
+
149
+ ### TagDir generation
150
+
151
+ - **Leaf TagDirs** — built in parallel via `tagdir_array.sbatch`, one array task per leaf (e.g. one task each for `K562/csRNA_r1`, `K562/csRNA_r2`, `K562/sRNA_r1`, `K562/sRNA_r2`, `K562/RNA_r1`).
152
+ - **Combined TagDirs** — built in parallel via `tagdirs_combo_array.sbatch`, one array task per Species/Sample, merging that sample's replicate leaves into a `<assay>-combo/` directory (e.g. `K562/csRNA-combo/`, `K562/sRNA-combo/`).
153
+
154
+ ### RITRIE (RIT/RIE QC metric)
155
+
156
+ `ritrie` computes RIT/RIE — reads at called TSRs vs. reads at exons (excluding TSR overlap) — a RIN-free proxy for RNA degradation. Higher values generally indicate stronger enrichment of transcription-initiation signal relative to exonic RNA; lower values may indicate more degraded RNA. Thresholds haven't yet been formally established.
157
+
158
+ This step requires a genome annotation GTF, passed via `--gtf` (or `CSRNA_GTF`). If it's unset, `ritrie` is simply skipped — that's not an error. If it *is* set but points at a missing/unreadable file, `prepare` fails immediately with a clear error rather than letting the pipeline run for hours and fail on `ritrie` at the very end.
159
+
160
+ ### Stability handling
161
+
162
+ The stability step is automatically skipped for samples without matching total RNA data. For example, if a sample has `csRNA_r1`/`csRNA_r2` and `sRNA_r1`/`sRNA_r2` leaves but no `RNA_r*` leaf, stability analysis is skipped for that sample. When stability analysis isn't performed, stability-specific columns are omitted from the report.
163
+
164
+ ### Run configuration (config.txt)
165
+
166
+ Every `prepare` run writes (or refreshes) `<project>/config.txt` — a plain-text summary of the run, meant to make a project directory self-documenting without digging through `config.env`, CLI history, or logs:
167
+
168
+ ```
169
+ # HomeRun csRNA-seq pipeline — run configuration
170
+ # Generated: 2026-07-14T12:01:49
171
+
172
+ [Config]
173
+ project = /path/to/homerun_test
174
+ aligner = star
175
+ genome_index = /path/to/STARIndex
176
+ genome = hg38
177
+ gtf = /path/to/gencode.v44.annotation.gtf
178
+ threads = 8
179
+ ...
180
+
181
+ [Samples]
182
+ count = 2
183
+ homo_sapiens/HepG2
184
+ homo_sapiens/K562
185
+
186
+ [RawData]
187
+ count = 3
188
+ homo_sapiens/HepG2/sRNA_r1/RawData/homo_sapiens_HepG2_sRNA-r1_DB477_S7_R1_001.fastq.gz
189
+ homo_sapiens/K562/csRNA_r1/RawData/homo_sapiens_K562_csRNA-r1_DB422_S1_R1_001.fastq.gz
190
+ homo_sapiens/K562/csRNA_r2/RawData/homo_sapiens_K562_csRNA-r2_DB423_S2_R1_001.fastq.gz
191
+ ```
192
+
193
+ `[Config]` lists every setting the run actually used — whatever was passed via CLI flag or `CSRNA_*` env var, or its built-in default if neither was set. `[Samples]` and `[RawData]` list every Species/Sample discovered and every staged FASTQ, so you can confirm what the pipeline saw before it spends hours processing it. It's safe to re-run `prepare` on a project that already has staged data or an old `config.txt` sitting in it — the file is simply overwritten with current information each time, and any leftovers from an older/different layout are ignored.
194
+
195
+ ## Quick start (w/o copying files and having fastqs in the project dir)
196
+
197
+ ```bash
198
+ path/to/homerun/submit_array.sh \
199
+ --project /PATH/TO/PROJECT \
200
+ --partition kamiak \
201
+ --conda-env CONDA_ENV_NAME \
202
+ --genome-index /path/to/STARIndex \
203
+ --genome hg38
204
+ ```
205
+
206
+ ## Quick start (with copying files via copy-src)
207
+
208
+ ```bash
209
+ path/to/homerun/submit_array.sh \
210
+ --project /PATH/TO/PROJECT \
211
+ --partition kamiak \
212
+ --conda-env CONDA_ENV_NAME \
213
+ --genome-index /path/to/STARIndex \
214
+ --genome hg38 \
215
+ --copy-src /PATH/TO/*.FASTQ.GZ
216
+ ```
217
+
218
+ ### Quick start (with RITRIE enabled)
219
+
220
+ ```bash
221
+ path/to/homerun/submit_array.sh \
222
+ --project /PATH/TO/PROJECT \
223
+ --partition kamiak \
224
+ --conda-env CONDA_ENV_NAME \
225
+ --genome-index /path/to/STARIndex \
226
+ --genome hg38 \
227
+ -- --gtf /path/to/genome.gtf
228
+ ```
229
+
230
+ The controller will:
231
+
232
+ - parse and stage raw FASTQs into the nested `Species/Sample/Leaf` project layout (e.g. `homo_sapiens_K562_csRNA-r1_DB422_S1_R1_001.fastq.gz` → `homo_sapiens/K562/csRNA_r1/RawData/`)
233
+ - write/refresh `config.txt` at the project root
234
+ - submit a prepare job (which also validates `--gtf` up front, if given)
235
+ - submit a sample-array job for trim + align
236
+ - submit a tagdir-array job (leaf TagDirs) and a tagdirs-combo-array job (combo TagDirs) in parallel
237
+ - submit a tss-array job and a bedgraphs-array job, each depending on the combo TagDirs (bedgraphs also needs the leaf TagDirs)
238
+ - submit a collect job that runs `ritrie`, QC, stability, and reporting
239
+
240
+ ## All flags
241
+
242
+ Required:
243
+
244
+ | Flag | Description |
245
+ |---|---|
246
+ | `--project` | Path to your project directory |
247
+ | `--partition` | SLURM partition name |
248
+ | `--conda-env` | Conda environment with pipeline dependencies |
249
+ | `--genome-index` | Path to STAR `--genomeDir` or HISAT2 `-x` index prefix |
250
+ | `--genome` | HOMER genome name (e.g. `hg38`) |
251
+
252
+ Optional:
253
+
254
+ | Flag | Default | Description |
255
+ |---|---|---|
256
+ | `--conda-module` | `anaconda3` | Cluster module that provides Conda |
257
+ | `--aligner` | `star` | Aligner to use: `star` or `hisat2` |
258
+ | `--throttle` | `16` | Max array tasks running at once |
259
+ | `--email` | | Email address for SLURM notifications |
260
+ | `--copy-src` | | Glob path to FASTQs to copy into the nested sample layout if none are present |
261
+ | `--starindex-url` | | URL to auto-download a STAR index tarball if none is found |
262
+ | `--ntag-threshold` | `7` | Minimum tags to call a TSS cluster |
263
+ | `--trim-min` | `20` | Discard reads shorter than this after trimming |
264
+ | `--trim-max` | `58` | Discard reads longer than this after trimming |
265
+ | `--trim-adapter` | `AGATCGGAAGAGCACACGTCT` | 3′ adapter sequence |
266
+ | `--skip-chr` | `chrEBV` | Chromosome to exclude from bedGraphs |
267
+ | `--gtf` | | Genome annotation GTF; enables the `ritrie` step. Skipped (not an error) if unset |
268
+
269
+ To pass extra flags directly to the Python pipeline (e.g. STAR tuning, or `--gtf`):
270
+
271
+ ```bash
272
+ path/to/homerun/submit_array.sh \
273
+ --project /PATH/TO/PROJECT \
274
+ --partition kamiak \
275
+ --conda-env CONDA_ENV_NAME \
276
+ --genome-index /path/to/STARIndex \
277
+ --genome hg38 \
278
+ -- --star-filter-multimap 5000 --gtf /path/to/genome.gtf
279
+ ```
280
+
281
+ To see all the flags do:
282
+
283
+ ```bash
284
+ path/to/homerun/submit_array.sh \
285
+ --h (or --help)
286
+ ```
287
+
288
+ Or call the Python package directly for the same output:
289
+
290
+ ```
291
+ $ python -m csrnaseq --help
292
+ usage: csrnaseq [-h] [--project PROJECT] [--log-path LOG_PATH]
293
+ [--steps {trim,align,tagdirs,tagdirs-combo,bedgraphs,tss,ritrie,qc,stability,report} [{trim,align,tagdirs,tagdirs-combo,bedgraphs,tss,ritrie,qc,stability,report} ...]]
294
+ [--sample-index SAMPLE_INDEX] [--group-index GROUP_INDEX] [--skip-prepare] [--only-prepare] [--count-samples] [--count-groups]
295
+ [--stage-raw] [--aligner {star,hisat2}] [--genome-index GENOME_INDEX] [--genome GENOME] [--gtf GTF] [--copy-src COPY_SRC]
296
+ [--threads THREADS] [--trim-adapter TRIM_ADAPTER] [--trim-min TRIM_MIN] [--trim-max TRIM_MAX] [--ntag-threshold NTAG_THRESHOLD]
297
+ [--skip-chr SKIP_CHR] [--star-filter-multimap STAR_FILTER_MULTIMAP] [--star-multimap-out STAR_MULTIMAP_OUT]
298
+ [--star-multimap-order {Random,Old_2.4}] [--hisat2-strandness {F,R,FR,RF}]
299
+
300
+ __ __
301
+ / / / /___ ____ ___ ___ _______ ______
302
+ / /_/ / __ \/ __ `__ \/ _ \/ ___/ / / / __ \
303
+ / __ / /_/ / / / / / / __/ / / /_/ / / / /
304
+ /_/ /_/\____/_/ /_/ /_/\___/_/ \__,_/_/ /_/
305
+
306
+ RNA-seq analysis pipeline for HPC clusters.
307
+ Version: 1.0.0
308
+
309
+ optional arguments:
310
+ -h, --help show this help message and exit
311
+ --project PROJECT Project root (default: $CSRNA_PROJECT or CWD).
312
+ --log-path LOG_PATH Pipeline log file path (overrides CSRNA_LOG; else timestamped file under <project>/logs/).
313
+ --steps {trim,align,tagdirs,tagdirs-combo,bedgraphs,tss,ritrie,qc,stability,report} [{trim,align,tagdirs,tagdirs-combo,bedgraphs,tss,ritrie,qc,stability,report} ...]
314
+ Run only these steps (still executed in canonical order).
315
+ --sample-index SAMPLE_INDEX
316
+ 0-based index into RawData R1 files. Restricts trim/align/tagdirs to one leaf run. Used by SLURM_ARRAY_TASK_ID.
317
+ --group-index GROUP_INDEX
318
+ 0-based index into list_samples(cfg). Restricts tagdirs-combo/bedgraphs/tss to one Species/Sample group. Used by
319
+ SLURM_ARRAY_TASK_ID.
320
+ --skip-prepare Skip folder creation/raw copy/STARIndex setup.
321
+ --only-prepare Run prepare and exit.
322
+ --count-samples Print number of leaf runs (R1 files in RawData) and exit.
323
+ --count-groups Print number of Species/Sample groups and exit.
324
+ --stage-raw Move loose *_R1*/*_R2* FASTQs into RawData/ and exit.
325
+
326
+ config overrides (override config.env when given):
327
+ --aligner {star,hisat2}
328
+ Aligner (overrides CSRNA_ALIGNER).
329
+ --genome-index GENOME_INDEX
330
+ STAR genomeDir or HISAT2 prefix (overrides CSRNA_GENOME_INDEX).
331
+ --genome GENOME HOMER genome (overrides CSRNA_GENOME).
332
+ --gtf GTF GTF annotation file for RIT/RIE metric (overrides CSRNA_GTF).
333
+ --copy-src COPY_SRC FASTQ copy source (overrides CSRNA_COPY_SRC).
334
+ --threads THREADS Threads (overrides CSRNA_THREADS / SLURM_CPUS_PER_TASK).
335
+ --trim-adapter TRIM_ADAPTER
336
+ 3' adapter sequence.
337
+ --trim-min TRIM_MIN Minimum read length after trimming.
338
+ --trim-max TRIM_MAX Maximum read length after trimming.
339
+ --ntag-threshold NTAG_THRESHOLD
340
+ Minimum tags for TSS calling.
341
+ --skip-chr SKIP_CHR Chromosome excluded from bedGraphs.
342
+
343
+ alignment overrides:
344
+ --star-filter-multimap STAR_FILTER_MULTIMAP
345
+ STAR outFilterMultimapNmax.
346
+ --star-multimap-out STAR_MULTIMAP_OUT
347
+ STAR outSAMmultNmax.
348
+ --star-multimap-order {Random,Old_2.4}
349
+ STAR outMultimapperOrder.
350
+ --hisat2-strandness {F,R,FR,RF}
351
+ HISAT2 RNA strandness.
352
+ ```
353
+
354
+ ## Requirements
355
+
356
+ The conda environment passed via `--conda-env` must provide:
357
+
358
+ | Tool | Used for | Notes |
359
+ |---|---|---|
360
+ | [HOMER](http://homer.ucsd.edu/homer/) | Tag directories, bedGraphs, TSS calling/annotation, RITRIE | Must include `homerTools` on `PATH`; genome data for `--genome` (e.g. `hg38`) must be installed via `perl configureHomer.pl -install hg38` |
361
+ | Python ≥3.9 | Runs the `csrnaseq` package | See [csrnaseq/README.md](csrnaseq/README.md) for Python package dependencies |
362
+ | [STAR](https://github.com/alexdobin/STAR) or [HISAT2](http://daehwankimlab.github.io/hisat2/) | Read alignment | Select via `--aligner`; a matching pre-built genome index is required (`--genome-index`) |
363
+ | SLURM | Job scheduling | Only required if using `submit_array.sh`. Tested on partitions with `sbatch`/`squeue`; `--partition` must be a valid partition on your cluster |
364
+
365
+ **Not on a SLURM cluster?** The same HOMER/Python/STAR-or-HISAT2 requirements apply — SLURM is only used by `submit_array.sh` to schedule the jobs. The underlying `csrnaseq` Python package can be run directly (`python -m csrnaseq ...`) on any machine that meets the requirements above, without SLURM at all. See [csrnaseq/README.md](csrnaseq/README.md) for running it standalone.
366
+
367
+ Quick check that required tools are available in your environment:
368
+
369
+ ```bash
370
+ conda activate CONDA_ENV_NAME
371
+ for t in homerTools STAR hisat2; do
372
+ command -v "$t" >/dev/null && echo "OK: $t" || echo "MISSING: $t"
373
+ done
374
+ ```
375
+
376
+ Note: only one of `STAR`/`hisat2` is required, depending on `--aligner`.
377
+
378
+ ## Notes
379
+
380
+ - The repo is built around the `csrnaseq` CLI, so most of the actual processing logic lives in the package under [csrnaseq](csrnaseq).
381
+ - Outputs live per-sample (nested under `Species/Sample/`, e.g. `homo_sapiens/K562/`) rather than in shared top-level directories, and each sample produces a single `qc_report.html` with concise, focused figures.
382
+ - Combined TagDirs/bedGraphs are per-assay `<assay>-combo/` directories (e.g. `csRNA-combo`, `sRNA-combo`), not a single catch-all folder — this keeps replicate merges scoped to their own assay.
383
+ - `tagdirs-combo`, `bedgraphs`, and `tss` each run as their own parallel SLURM array (indexed by `--group-index`, one task per Species/Sample) rather than looping serially inside `collect` — see the [job-array dependency graph](#job-array-dependency-graph) above.
384
+ - `config.txt` at the project root is regenerated at the end of every `prepare` run — check it first if a run behaves unexpectedly, to confirm the pipeline actually saw the config/samples you intended.
385
+ - For package-specific installation details, module descriptions, and CLI internals, see [csrnaseq/README.md](csrnaseq/README.md).