degrseq 0.1.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.
- degrseq-0.1.0/.gitignore +14 -0
- degrseq-0.1.0/.pre-commit-config.yaml +25 -0
- degrseq-0.1.0/.python-version +1 -0
- degrseq-0.1.0/AGENTS.md +68 -0
- degrseq-0.1.0/CHANGELOG.md +164 -0
- degrseq-0.1.0/LICENSE +21 -0
- degrseq-0.1.0/PKG-INFO +108 -0
- degrseq-0.1.0/README.md +83 -0
- degrseq-0.1.0/pyproject.toml +58 -0
- degrseq-0.1.0/src/degrseq/__init__.py +8 -0
- degrseq-0.1.0/src/degrseq/__main__.py +5 -0
- degrseq-0.1.0/src/degrseq/cap_class.py +271 -0
- degrseq-0.1.0/src/degrseq/cleavage_stats.py +450 -0
- degrseq-0.1.0/src/degrseq/cli.py +48 -0
- degrseq-0.1.0/src/degrseq/end_counts.py +1031 -0
- degrseq-0.1.0/src/degrseq/kde_peaks.py +370 -0
- degrseq-0.1.0/src/degrseq/py.typed +0 -0
- degrseq-0.1.0/src/degrseq/scale_factor.py +257 -0
- degrseq-0.1.0/src/degrseq/srna_shuffle.py +133 -0
- degrseq-0.1.0/uv.lock +401 -0
degrseq-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
exclude: ^tests/fixtures/
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
exclude: ^tests/fixtures/
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- id: check-added-large-files
|
|
12
|
+
args: [--maxkb=8192]
|
|
13
|
+
- id: check-merge-conflict
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
16
|
+
rev: v0.14.4
|
|
17
|
+
hooks:
|
|
18
|
+
- id: ruff-check
|
|
19
|
+
args: [--fix]
|
|
20
|
+
- id: ruff-format
|
|
21
|
+
|
|
22
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
23
|
+
rev: 0.9.9
|
|
24
|
+
hooks:
|
|
25
|
+
- id: uv-lock
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
degrseq-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Notes for coding agents and contributors. Structure adapted from
|
|
4
|
+
[mgnifam](https://github.com/vagkaratzas/mgnifam) (MIT). This file covers the rules that will bite you.
|
|
5
|
+
|
|
6
|
+
## Ground rules
|
|
7
|
+
|
|
8
|
+
- **Clean-room: write from `specs/`, never from nanoPARE source.** nanoPARE
|
|
9
|
+
(https://github.com/Gregor-Mendel-Institute/nanoPARE, commit `6264d6f`) is GPL-3. This
|
|
10
|
+
package is MIT because it is written from behavioural specifications, not translated line by
|
|
11
|
+
line. So, unlike mgnifam's `reference/`, **the original scripts are not vendored here**. The
|
|
12
|
+
behavioural oracle is the set of golden outputs produced by running the original (see
|
|
13
|
+
Testing). Each module docstring states which spec it implements.
|
|
14
|
+
- **Never add a dependency without updating the design-side dependency list.** Allowed:
|
|
15
|
+
numpy, pysam, scipy (upper-bounded on purpose: they decide numeric output, so parity
|
|
16
|
+
holds only for the resolved set in `uv.lock`). Interval operations (sort, merge, closest,
|
|
17
|
+
subtract) belong in bedtools processes in the pipeline, not here.
|
|
18
|
+
- Use `uv lock --check && uv sync --frozen` before trusting a test result.
|
|
19
|
+
- Commits and pushes are the human's call.
|
|
20
|
+
|
|
21
|
+
## Naming contract
|
|
22
|
+
|
|
23
|
+
Subcommand `end-counts` ↔ module `src/degrseq/end_counts.py` ↔ spec
|
|
24
|
+
`specs/end-counts.md` ↔ pipeline module `modules/local/end_counts/` ↔ process `END_COUNTS`.
|
|
25
|
+
`tests/test_cli.py` enforces the first two. Each module exposes `main(argv)` and owns its
|
|
26
|
+
parser, with `prog="degrseq <name>"`.
|
|
27
|
+
|
|
28
|
+
Flags are `--snake_case` (`--n_shuffles`, `--nanopare_compat`), matching Nextflow `params`,
|
|
29
|
+
so a pipeline parameter and the flag it feeds have the same name.
|
|
30
|
+
|
|
31
|
+
## Behaviour vs nanoPARE
|
|
32
|
+
|
|
33
|
+
- **Default = fixed behaviour; `--nanopare_compat` = the original's quirks.** Every upstream
|
|
34
|
+
bug a subcommand touches is listed in its spec under "Quirks" with a decision (fix /
|
|
35
|
+
reproduce / fix + compat). Golden tests run in compat mode and must match. Default-mode
|
|
36
|
+
tests must differ from golden output by exactly what each fix predicts.
|
|
37
|
+
- Deliberate differences go in `CHANGELOG.md` and in the spec, never only in code.
|
|
38
|
+
|
|
39
|
+
## Reproducibility
|
|
40
|
+
|
|
41
|
+
- Outputs must be byte-identical across runs, `--cpus` values and `PYTHONHASHSEED`. Sort
|
|
42
|
+
explicitly before writing; never depend on dict or set iteration order for output.
|
|
43
|
+
- Anything random takes a `--seed` (e.g. `srna-shuffle`), and the seed is written to the stats file.
|
|
44
|
+
|
|
45
|
+
## Stats files (MultiQC contract)
|
|
46
|
+
|
|
47
|
+
Each subcommand that produces QC numbers writes `<prefix>.<subcommand>.stats.json` with a
|
|
48
|
+
`schema_version` field. A MultiQC module will parse it, so its shape is a contract: bump
|
|
49
|
+
`schema_version` on any breaking change. Record scientific parameters only (no paths, no `--cpus`).
|
|
50
|
+
|
|
51
|
+
## Testing
|
|
52
|
+
|
|
53
|
+
- `uv run pytest`. Unit tests use small handmade inputs placed in `tests/fixtures/`, each
|
|
54
|
+
built to isolate one rule from the spec.
|
|
55
|
+
- Golden tests compare against outputs of the original nanoPARE run on its own test set
|
|
56
|
+
(Arabidopsis chr2 window). Only the *outputs* are committed as fixtures (keep each under
|
|
57
|
+
8 MB; `pre-commit` enforces it), plus a README recording the command, interpreter and
|
|
58
|
+
commit that produced them.
|
|
59
|
+
- When you change scientific behaviour, the honest check is a diff against golden output,
|
|
60
|
+
not a green test suite.
|
|
61
|
+
|
|
62
|
+
## Adding a subcommand
|
|
63
|
+
|
|
64
|
+
1. Approve its spec (`specs/<name>.md`, from `specs/TEMPLATE.md`).
|
|
65
|
+
2. Add `src/degrseq/<name_with_underscores>.py` with `main(argv)`.
|
|
66
|
+
3. Register it in `cli.COMMANDS`.
|
|
67
|
+
4. Add unit tests for each rule and edge case in the spec, then the golden test.
|
|
68
|
+
5. Update `CHANGELOG.md` and the pipeline's local module (replace its stub).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
|
|
6
|
+
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-12-03
|
|
11
|
+
|
|
12
|
+
First release. Six subcommands, each implementing an approved spec in `specs/`: `end-counts`,
|
|
13
|
+
`scale-factor`, `kde-peaks`, `cap-class`, `srna-shuffle`, `cleavage-stats`. Not included: the
|
|
14
|
+
low-complexity read filter and sequence-bias correction (both off by default in nanoPARE).
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Release workflow publishes to PyPI (trusted publishing, environment `pypi`) after TestPyPI.
|
|
19
|
+
- README: install, subcommand overview with the nanoPARE steps they replace, example, citation.
|
|
20
|
+
- Package skeleton: `degrseq` command dispatcher, spec template, CI, pre-commit.
|
|
21
|
+
- Release workflow: tags `v*` run CI, build, `twine check`, smoke-test the wheel and publish to
|
|
22
|
+
TestPyPI via trusted publishing.
|
|
23
|
+
- `end-counts`: per-nucleotide 5′ ends, cap track (5P), optional coverage, stats JSON.
|
|
24
|
+
Implements `specs/end-counts.md`.
|
|
25
|
+
- `end-counts --nanopare_compat`: reproduces the original's quirks (spec quirk table, DL-045).
|
|
26
|
+
Matches the golden fixture byte for byte (5P ends, cap, BODY ends, BODY coverage); golden test
|
|
27
|
+
`tests/test_end_counts_golden.py`. Requires `--multimapper_mode rescue`; values fixed at 2
|
|
28
|
+
decimals, so `--decimals` is an error (DL-047). New read fate `multimapped_lost_compat` (always 0 in default mode).
|
|
29
|
+
Single-end only: paired-end input is an error (DL-046). With `--write_coverage` it warns about
|
|
30
|
+
memory and builds coverage one chromosome and strand at a time (DL-047), skipping positions past
|
|
31
|
+
the chromosome end (DL-048).
|
|
32
|
+
- `end-counts` golden fixture (`tests/fixtures/end_counts_golden/`): nanoPARE test-set subsample and the
|
|
33
|
+
original's outputs on it. Pre-commit whitespace hooks skip `tests/fixtures/` so fixtures stay byte-exact;
|
|
34
|
+
`.gitignore` ignores `golden/` and `scratch/` only at the repo root, so fixture folders are tracked.
|
|
35
|
+
|
|
36
|
+
- `end-counts`: paired-end `--min_aligned` counts both mates' positions, as nanoPARE does (DL-062); test added.
|
|
37
|
+
|
|
38
|
+
- `srna-shuffle`: shuffled sRNA sets for the cleavage null model (`--n_shuffles`, `--seed`,
|
|
39
|
+
`--layout combined|per_set`), stats JSON. Implements `specs/srna-shuffle.md`.
|
|
40
|
+
|
|
41
|
+
- `cleavage-stats`: significant sRNA cleavage sites from real vs shuffled-sRNA step-1 tables
|
|
42
|
+
(empirical p-values, Fisher, BH, window join), `--nanopare_compat`, stats JSON.
|
|
43
|
+
Implements `specs/cleavage-stats.md`.
|
|
44
|
+
|
|
45
|
+
- `scale-factor`: the 5P-vs-BODY scale factor for EndGraph (`factor × 5P − BODY`), from gene regions
|
|
46
|
+
(BED6) and ends bedgraphs; `--fraglen`, `--body_strand`, `--max_scale_factor`, `--write_genes`, stats JSON.
|
|
47
|
+
Implements `specs/scale-factor.md` (DL-063). Deliberate differences from nanoPARE: no compat mode
|
|
48
|
+
(DL-058); per-gene BODY counts are counts with shared positions split, not density × length (known
|
|
49
|
+
issues 44, 45); last gene of a chromosome included (#43); gene length = region size (DL-059); empty
|
|
50
|
+
totals are an error (DL-060); factor printed with 4 fixed decimals. On nanoPARE's test set:
|
|
51
|
+
0.3871 / 0.1903 / 0.2103 vs the original's 0.3924 / 0.2100 / 0.2121. Fixture
|
|
52
|
+
`tests/fixtures/scale_factor_test_set/` (1.5 MB, gzipped).
|
|
53
|
+
- `scale-factor --body_strand unstranded`: BODY plus + minus summed per nt as background for genes on both strands,
|
|
54
|
+
for unstranded BODY libraries (DL-069). Default `reverse` unchanged (= nanoPARE's hard-coded flip).
|
|
55
|
+
- `kde-peaks`: 5′-end features of a 5P library (EndGraph): scale × 5P − BODY, Laplace kernel density, runs of
|
|
56
|
+
positive density ≥ `--min_length`, density peaks, dominant 5P position, RPM filter; `--body_strand`
|
|
57
|
+
(`reverse`/`forward`/`unstranded`), `--write_density`, `--nanopare_compat`, stats JSON. Implements
|
|
58
|
+
`specs/kde-peaks.md` (DL-072, DL-073). Compat matches nanoPARE's golden EndGraph outputs on the test set
|
|
59
|
+
(density byte-identical; features identical up to the order of rows with equal start).
|
|
60
|
+
|
|
61
|
+
- `cap-class`: capped / noncapped 5′-end features of a replicate group (EndClass, numeric part): per-nt
|
|
62
|
+
replicate sums of 5P and cap tracks, trim to signal, rightmost peak, uG fraction split; `--min_uug`,
|
|
63
|
+
`--min_reads`, `--decimals`, `--nanopare_compat`, stats JSON. Implements `specs/cap-class.md` (DL-087).
|
|
64
|
+
Compat matches nanoPARE's EndClass outputs on the test set (sum bedgraphs byte-identical; peaks and
|
|
65
|
+
capped/noncapped sets identical; 323 / 279). Fixture `tests/fixtures/cap_class_golden/` (415 kB).
|
|
66
|
+
|
|
67
|
+
### Differences from nanoPARE (`cap-class`, see the spec's quirk table)
|
|
68
|
+
|
|
69
|
+
- uG counted over the exact feature, no "+1 buffer"; ends and peak offsets 1 nt shorter (DL-074, known issue 15).
|
|
70
|
+
- `--min_uug 0` calls every feature capped; compat keeps the automatic cutoff (DL-080, known issue 50).
|
|
71
|
+
- Features keyed by chromosome, start, end and strand (known issues 52, 53).
|
|
72
|
+
- Replicate sums exact, written with 4 decimals (DL-085); uG sums always written (DL-086).
|
|
73
|
+
- Default mode stops when uG exceeds 5P in a feature (per-G cap track fed to default mode).
|
|
74
|
+
- Not ported: gene counts tables (DL-076), cap-mask bedgraphs (EndMask).
|
|
75
|
+
|
|
76
|
+
### Documentation
|
|
77
|
+
|
|
78
|
+
- `end-counts` spec: limitation added, a cap G over a genomic G looks templated (DL-079).
|
|
79
|
+
- `end-counts` spec: a non-zero `nh_mismatch` now means split reads, since the pipeline deduplicates UMIs once per read.
|
|
80
|
+
|
|
81
|
+
### Fixed (external code review of `cb08476`, 30/10)
|
|
82
|
+
- `end-counts`: an alignment past the reference end is an error, not a crash in
|
|
83
|
+
`--write_coverage`; `XW` must be finite and ≥ 0; paired-end reads with `HI` on only some
|
|
84
|
+
records pair mates by position; `kept_3prime_clip_only` no longer counts reads dropped by
|
|
85
|
+
`--multimapper_mode unique`; mate sequences are kept apart in block identity; clean errors
|
|
86
|
+
for missing inputs and output folders (also `srna-shuffle`); separate messages for
|
|
87
|
+
`--min_aligned` and `--decimals`; the FASTA is closed.
|
|
88
|
+
- `end-counts`: read names that come back after another name are counted in stats
|
|
89
|
+
(`read_names_repeated`) and warned about; counting is unchanged.
|
|
90
|
+
- `end-counts --write_coverage` (default) uses memory proportional to the intervals, not the
|
|
91
|
+
chromosome length; multimapper rescue and coverage no longer scan every interval per
|
|
92
|
+
reference. Output unchanged.
|
|
93
|
+
- All outputs are written as UTF-8.
|
|
94
|
+
|
|
95
|
+
### Differences from nanoPARE (`srna-shuffle`)
|
|
96
|
+
|
|
97
|
+
- Seeded (`--seed`, default 0): the same input and seed give identical output. The original was
|
|
98
|
+
unseeded. Shuffles are statistically indistinguishable from the original's.
|
|
99
|
+
- Default output is one combined FASTA (`<prefix>.shuffled.fa`); `--layout per_set` writes one
|
|
100
|
+
file per set, as the original.
|
|
101
|
+
- Multi-line FASTA accepted; header descriptions dropped from IDs; duplicate IDs and empty
|
|
102
|
+
sequences are errors.
|
|
103
|
+
|
|
104
|
+
### Differences from nanoPARE (`kde-peaks`, see the spec's quirk table)
|
|
105
|
+
|
|
106
|
+
- Full kernel (the original drops the +W weight), density stops at the chromosome end, feature end exclusive
|
|
107
|
+
(the original's is 1 nt short and leaves the last nt out of RPM and the dominant position), RPM over both
|
|
108
|
+
strands' total (the original uses twice the plus total), no 2-decimal rounding of the difference before smoothing.
|
|
109
|
+
Test set: replicable features 602 → 608 (DL-065, DL-066).
|
|
110
|
+
- A chromosome missing from `--lengths` is an error (the original crashes or drops features silently).
|
|
111
|
+
- No Gaussian kernel (DL-068); `--bandwidth` above 30 is an error (the original caps it silently).
|
|
112
|
+
- Smoothed density only with `--write_density` (DL-067).
|
|
113
|
+
|
|
114
|
+
### Differences from nanoPARE (`end-counts`, see the spec's quirk table)
|
|
115
|
+
|
|
116
|
+
- Cap counted once per read at its 5′ end, weighted, instead of per untemplated G upstream.
|
|
117
|
+
- Same minimum length (`--min_aligned`, default 16) for unique and multimapped reads,
|
|
118
|
+
reclaimed bases included.
|
|
119
|
+
- Clipped bases are taken back from the alignment edge outwards on both ends, ignoring genome
|
|
120
|
+
case; `N` never matches; bases past a chromosome end count as untemplated. None of these
|
|
121
|
+
differs from nanoPARE on STAR output (no clipped base next to an alignment matches the genome).
|
|
122
|
+
- BODY multimapped reads are grouped by sequence and locus set; nanoPARE groups them by CIGAR
|
|
123
|
+
and counts every read of a group at the last read's loci (21–26 % of BODY multimapped reads in
|
|
124
|
+
the nanoPARE test set). `--nanopare_compat` reproduces it.
|
|
125
|
+
- Paired-end: the 5′ end always comes from mate 1, and a non-G clip on mate 1 discards the read.
|
|
126
|
+
nanoPARE takes the outermost position over both mates and keeps mate 2; this can't occur with
|
|
127
|
+
its published STAR settings. `--nanopare_compat` refuses paired-end input.
|
|
128
|
+
- Bedgraphs: no `0.0` rows in the cap track; a 5′ end at chromosome position 0 is kept; BODY
|
|
129
|
+
coverage sums unrounded strand values.
|
|
130
|
+
- Only the 5′ clip is examined: reads with untemplated bases at the 3′ side (alone or together
|
|
131
|
+
with a 5′ clip) are kept, and 3′ bases never count as cap signal. The original drops them.
|
|
132
|
+
- Loci keyed by (reference, strand, 5′ end), not start position only.
|
|
133
|
+
- Values at 4 decimals, one row per nucleotide (no merged runs).
|
|
134
|
+
- Ties between multimapper blocks broken by sequence, then locus list; identical reads
|
|
135
|
+
with different locus sets are shared separately.
|
|
136
|
+
- Multimapped reads: alignments with a non-G extra 5′ base are removed before the read is
|
|
137
|
+
shared, so a read with one usable alignment is never lost. The original computes the shares
|
|
138
|
+
first and can drop such reads silently.
|
|
139
|
+
- Cap signal comes only from reads that are counted, and only from the 5′ clip. The original
|
|
140
|
+
also adds it for reads too short to be counted, and for G's in a 3′ clip.
|
|
141
|
+
|
|
142
|
+
### Differences from nanoPARE (`cleavage-stats`)
|
|
143
|
+
- Inputs are arguments, not fixed `Ath_annotations/` paths; class and family can come from
|
|
144
|
+
`--srna_table` (name rule as fallback); unclassified sRNAs are skipped with a warning.
|
|
145
|
+
- Shuffled sites come as one pooled table per window (DL-050), so any number of sets works.
|
|
146
|
+
- An sRNA with no shuffled sites gets p = 1 and a warning; the original stops with an error.
|
|
147
|
+
- An sRNA may have several precursors (self:self removal checks all); the original stops on
|
|
148
|
+
duplicate rows. sRNAs with real sites missing from `--srna_table` are counted and warned.
|
|
149
|
+
- A site found only in W50, or a window without sites, no longer stops the run (Q10).
|
|
150
|
+
- Labels: a site found in one window keeps its common name; `verified.` is `yes` if either
|
|
151
|
+
window says yes; `interaction` uses the reported sRNA. Compat keeps R's `min()` and the
|
|
152
|
+
W20 sRNA (Q3, Q9).
|
|
153
|
+
- Output order breaks adj-p ties by fold change, sRNA, transcript and site; compat keeps R's
|
|
154
|
+
order (by `Transcript_Slice.site` text, then adj p).
|
|
155
|
+
- New per class: `significant_sites.tsv`, `window_tests.tsv` (every tested site per window with
|
|
156
|
+
its p-values) and `shuffled_values.tsv` (the shuffled values behind them). Per-sRNA ECDF PDFs
|
|
157
|
+
are not written; plotting is left to the pipeline, from these tables (DL-054, DL-055).
|
|
158
|
+
- A validated target also matches by its own sRNA name, so explicit families work
|
|
159
|
+
(`miR2934` validates `miR2934-3p`); no change with the name rule alone.
|
|
160
|
+
- p-values are kept as the original (no +1; DL-051).
|
|
161
|
+
- adj p can differ from R in the 15th significant digit (scipy vs R chi-square tail).
|
|
162
|
+
|
|
163
|
+
[Unreleased]: https://github.com/IceGreb/degrseq/compare/v0.1.0...HEAD
|
|
164
|
+
[0.1.0]: https://github.com/IceGreb/degrseq/releases/tag/v0.1.0
|
degrseq-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nikolaos Vergoulidis
|
|
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.
|
degrseq-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: degrseq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Subcommands for the rnadegradome pipeline: RNA 5' end mapping, cap classification and sRNA cleavage detection
|
|
5
|
+
Project-URL: Documentation, https://github.com/IceGreb/degrseq/tree/main/specs
|
|
6
|
+
Project-URL: Repository, https://github.com/IceGreb/degrseq
|
|
7
|
+
Project-URL: Issues, https://github.com/IceGreb/degrseq/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/IceGreb/degrseq/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Nikolaos Vergoulidis
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: bioinformatics,cleavage,degradome,nanopare,rna-5-prime-ends,small-rna
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: numpy<3,>=1.26
|
|
22
|
+
Requires-Dist: pysam<0.24,>=0.22
|
|
23
|
+
Requires-Dist: scipy<2,>=1.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# degrseq
|
|
27
|
+
|
|
28
|
+
[](https://github.com/IceGreb/degrseq/actions/workflows/ci.yml)
|
|
29
|
+
|
|
30
|
+
Command-line tools for RNA 5′-end sequencing: count 5′ ends from alignments, find 5′-end features, split them into capped and noncapped, and call small-RNA-directed cleavage sites.
|
|
31
|
+
|
|
32
|
+
degrseq holds the custom steps of the rnadegradome Nextflow pipeline (in development), a reimplementation of nanoPARE (Schon et al. 2018). Each step is one subcommand. Standard operations (trimming, alignment, interval arithmetic) are left to standard tools in the pipeline.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install degrseq
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Python ≥ 3.12. Dependencies: numpy, pysam, scipy.
|
|
41
|
+
|
|
42
|
+
## Subcommands
|
|
43
|
+
|
|
44
|
+
| Subcommand | What it does | Replaces in nanoPARE | Main outputs |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| `end-counts` | Counts 5′ ends per nucleotide from STAR alignments; for 5P libraries also a cap track (reads with an untemplated 5′ G). Shares multimapped reads by nearby unique coverage | EndMap: `readmapIO.py` | `<prefix>.ends.{plus,minus}.bedgraph`, `<prefix>.cap.{plus,minus}.bedgraph` |
|
|
47
|
+
| `scale-factor` | One factor per sample that puts 5P and BODY libraries on the same scale | EndGraph: `gtf_quantify.py` + ratio | `<prefix>.scale_factor.txt` |
|
|
48
|
+
| `kde-peaks` | 5′-end features: scale × 5P − BODY, smoothed with a Laplace kernel, runs of positive density, peak and RPM filter | EndGraph: kernel density, threshold, peaks | `<prefix>.end_features.bed` |
|
|
49
|
+
| `cap-class` | Sums replicates over replicable features and splits them into capped and noncapped by their untemplated-G fraction | EndClass: feature coverage, uG filter | `<prefix>.capped.bed`, `<prefix>.noncapped.bed`, `<prefix>.peaks.bed` |
|
|
50
|
+
| `srna-shuffle` | Shuffled copies of each small RNA (same length and composition) as the null model for cleavage calling | EndCut: `sRNA_shuffler.py` | `<prefix>.shuffled.fa` |
|
|
51
|
+
| `cleavage-stats` | Significant cleavage sites: real vs shuffled small RNAs, empirical p-values, Fisher's method, Benjamini–Hochberg | EndCut step 2 (R) | `<prefix>.<class>.{detected,significant}_sites.tsv` |
|
|
52
|
+
|
|
53
|
+
Every subcommand also writes `<prefix>.<subcommand>.stats.json` (counts and parameters, for MultiQC). Run `degrseq <subcommand> --help` for the options.
|
|
54
|
+
|
|
55
|
+
Each subcommand is defined by a behavioural specification: inputs, outputs, numbered rules, edge cases and every difference from nanoPARE. See [`specs/`](https://github.com/IceGreb/degrseq/tree/main/specs).
|
|
56
|
+
|
|
57
|
+
## Example
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# 5′ ends and cap track of a 5P library (alignments of each read adjacent, as STAR writes them)
|
|
61
|
+
degrseq end-counts --bam flower_1_5P.bam --fasta genome.fa --library 5P --prefix flower_1_5P
|
|
62
|
+
degrseq end-counts --bam flower_1_BODY.bam --library BODY --prefix flower_1_BODY
|
|
63
|
+
|
|
64
|
+
# scale factor, then 5′-end features
|
|
65
|
+
degrseq scale-factor \
|
|
66
|
+
--ends_plus flower_1_5P.ends.plus.bedgraph --ends_minus flower_1_5P.ends.minus.bedgraph \
|
|
67
|
+
--body_plus flower_1_BODY.ends.plus.bedgraph --body_minus flower_1_BODY.ends.minus.bedgraph \
|
|
68
|
+
--regions gene_regions.bed --prefix flower_1
|
|
69
|
+
degrseq kde-peaks \
|
|
70
|
+
--ends_plus flower_1_5P.ends.plus.bedgraph --ends_minus flower_1_5P.ends.minus.bedgraph \
|
|
71
|
+
--body_plus flower_1_BODY.ends.plus.bedgraph --body_minus flower_1_BODY.ends.minus.bedgraph \
|
|
72
|
+
--scale_factor flower_1.scale_factor.txt --lengths genome.fa.fai --prefix flower_1
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The full chain, including the bedtools steps between subcommands, is the rnadegradome pipeline.
|
|
76
|
+
|
|
77
|
+
## Differences from nanoPARE
|
|
78
|
+
|
|
79
|
+
- **Default mode fixes the bugs found in nanoPARE.** Every fix is listed in the subcommand's spec with its effect on nanoPARE's test data.
|
|
80
|
+
- **`--nanopare_compat`** (`end-counts`, `kde-peaks`, `cap-class`, `cleavage-stats`) reproduces the original's behaviour. In this mode the outputs match nanoPARE's own outputs on its test set; these comparisons are part of the test suite.
|
|
81
|
+
- Outputs are identical across runs; random steps take `--seed`.
|
|
82
|
+
- degrseq is written from the specifications, not translated from nanoPARE's code (GPL-3), which is why it can be MIT-licensed.
|
|
83
|
+
|
|
84
|
+
## Not included yet
|
|
85
|
+
|
|
86
|
+
- Low-complexity read filter (nanoPARE's `fastq_complexity_filter.py`; off by default in nanoPARE).
|
|
87
|
+
- Sequence-bias correction (Wang et al.), used in the paper but off by default in nanoPARE's code.
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
uv lock --check && uv sync --frozen
|
|
93
|
+
uv run pre-commit install
|
|
94
|
+
uv run pre-commit run --all-files
|
|
95
|
+
uv run pytest
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Contributor rules are in [`AGENTS.md`](https://github.com/IceGreb/degrseq/blob/main/AGENTS.md).
|
|
99
|
+
|
|
100
|
+
## Citation
|
|
101
|
+
|
|
102
|
+
If you use degrseq, please cite the method it implements:
|
|
103
|
+
|
|
104
|
+
Schon MA, Kellner MJ, Plotnikova A, Hofmann F, Nodine MD (2018). NanoPARE: parallel analysis of RNA 5′ ends from low-input RNA. *Genome Research* 28:1931–1942. https://doi.org/10.1101/gr.239202.118
|
|
105
|
+
|
|
106
|
+
## Licence
|
|
107
|
+
|
|
108
|
+
MIT. See [`LICENSE`](https://github.com/IceGreb/degrseq/blob/main/LICENSE).
|
degrseq-0.1.0/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# degrseq
|
|
2
|
+
|
|
3
|
+
[](https://github.com/IceGreb/degrseq/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
Command-line tools for RNA 5′-end sequencing: count 5′ ends from alignments, find 5′-end features, split them into capped and noncapped, and call small-RNA-directed cleavage sites.
|
|
6
|
+
|
|
7
|
+
degrseq holds the custom steps of the rnadegradome Nextflow pipeline (in development), a reimplementation of nanoPARE (Schon et al. 2018). Each step is one subcommand. Standard operations (trimming, alignment, interval arithmetic) are left to standard tools in the pipeline.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install degrseq
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Python ≥ 3.12. Dependencies: numpy, pysam, scipy.
|
|
16
|
+
|
|
17
|
+
## Subcommands
|
|
18
|
+
|
|
19
|
+
| Subcommand | What it does | Replaces in nanoPARE | Main outputs |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| `end-counts` | Counts 5′ ends per nucleotide from STAR alignments; for 5P libraries also a cap track (reads with an untemplated 5′ G). Shares multimapped reads by nearby unique coverage | EndMap: `readmapIO.py` | `<prefix>.ends.{plus,minus}.bedgraph`, `<prefix>.cap.{plus,minus}.bedgraph` |
|
|
22
|
+
| `scale-factor` | One factor per sample that puts 5P and BODY libraries on the same scale | EndGraph: `gtf_quantify.py` + ratio | `<prefix>.scale_factor.txt` |
|
|
23
|
+
| `kde-peaks` | 5′-end features: scale × 5P − BODY, smoothed with a Laplace kernel, runs of positive density, peak and RPM filter | EndGraph: kernel density, threshold, peaks | `<prefix>.end_features.bed` |
|
|
24
|
+
| `cap-class` | Sums replicates over replicable features and splits them into capped and noncapped by their untemplated-G fraction | EndClass: feature coverage, uG filter | `<prefix>.capped.bed`, `<prefix>.noncapped.bed`, `<prefix>.peaks.bed` |
|
|
25
|
+
| `srna-shuffle` | Shuffled copies of each small RNA (same length and composition) as the null model for cleavage calling | EndCut: `sRNA_shuffler.py` | `<prefix>.shuffled.fa` |
|
|
26
|
+
| `cleavage-stats` | Significant cleavage sites: real vs shuffled small RNAs, empirical p-values, Fisher's method, Benjamini–Hochberg | EndCut step 2 (R) | `<prefix>.<class>.{detected,significant}_sites.tsv` |
|
|
27
|
+
|
|
28
|
+
Every subcommand also writes `<prefix>.<subcommand>.stats.json` (counts and parameters, for MultiQC). Run `degrseq <subcommand> --help` for the options.
|
|
29
|
+
|
|
30
|
+
Each subcommand is defined by a behavioural specification: inputs, outputs, numbered rules, edge cases and every difference from nanoPARE. See [`specs/`](https://github.com/IceGreb/degrseq/tree/main/specs).
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# 5′ ends and cap track of a 5P library (alignments of each read adjacent, as STAR writes them)
|
|
36
|
+
degrseq end-counts --bam flower_1_5P.bam --fasta genome.fa --library 5P --prefix flower_1_5P
|
|
37
|
+
degrseq end-counts --bam flower_1_BODY.bam --library BODY --prefix flower_1_BODY
|
|
38
|
+
|
|
39
|
+
# scale factor, then 5′-end features
|
|
40
|
+
degrseq scale-factor \
|
|
41
|
+
--ends_plus flower_1_5P.ends.plus.bedgraph --ends_minus flower_1_5P.ends.minus.bedgraph \
|
|
42
|
+
--body_plus flower_1_BODY.ends.plus.bedgraph --body_minus flower_1_BODY.ends.minus.bedgraph \
|
|
43
|
+
--regions gene_regions.bed --prefix flower_1
|
|
44
|
+
degrseq kde-peaks \
|
|
45
|
+
--ends_plus flower_1_5P.ends.plus.bedgraph --ends_minus flower_1_5P.ends.minus.bedgraph \
|
|
46
|
+
--body_plus flower_1_BODY.ends.plus.bedgraph --body_minus flower_1_BODY.ends.minus.bedgraph \
|
|
47
|
+
--scale_factor flower_1.scale_factor.txt --lengths genome.fa.fai --prefix flower_1
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The full chain, including the bedtools steps between subcommands, is the rnadegradome pipeline.
|
|
51
|
+
|
|
52
|
+
## Differences from nanoPARE
|
|
53
|
+
|
|
54
|
+
- **Default mode fixes the bugs found in nanoPARE.** Every fix is listed in the subcommand's spec with its effect on nanoPARE's test data.
|
|
55
|
+
- **`--nanopare_compat`** (`end-counts`, `kde-peaks`, `cap-class`, `cleavage-stats`) reproduces the original's behaviour. In this mode the outputs match nanoPARE's own outputs on its test set; these comparisons are part of the test suite.
|
|
56
|
+
- Outputs are identical across runs; random steps take `--seed`.
|
|
57
|
+
- degrseq is written from the specifications, not translated from nanoPARE's code (GPL-3), which is why it can be MIT-licensed.
|
|
58
|
+
|
|
59
|
+
## Not included yet
|
|
60
|
+
|
|
61
|
+
- Low-complexity read filter (nanoPARE's `fastq_complexity_filter.py`; off by default in nanoPARE).
|
|
62
|
+
- Sequence-bias correction (Wang et al.), used in the paper but off by default in nanoPARE's code.
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv lock --check && uv sync --frozen
|
|
68
|
+
uv run pre-commit install
|
|
69
|
+
uv run pre-commit run --all-files
|
|
70
|
+
uv run pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Contributor rules are in [`AGENTS.md`](https://github.com/IceGreb/degrseq/blob/main/AGENTS.md).
|
|
74
|
+
|
|
75
|
+
## Citation
|
|
76
|
+
|
|
77
|
+
If you use degrseq, please cite the method it implements:
|
|
78
|
+
|
|
79
|
+
Schon MA, Kellner MJ, Plotnikova A, Hofmann F, Nodine MD (2018). NanoPARE: parallel analysis of RNA 5′ ends from low-input RNA. *Genome Research* 28:1931–1942. https://doi.org/10.1101/gr.239202.118
|
|
80
|
+
|
|
81
|
+
## Licence
|
|
82
|
+
|
|
83
|
+
MIT. See [`LICENSE`](https://github.com/IceGreb/degrseq/blob/main/LICENSE).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "degrseq"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Subcommands for the rnadegradome pipeline: RNA 5' end mapping, cap classification and sRNA cleavage detection"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Nikolaos Vergoulidis" }]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
keywords = ["bioinformatics", "degradome", "nanopare", "rna-5-prime-ends", "small-rna", "cleavage"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Science/Research",
|
|
14
|
+
"Operating System :: POSIX :: Linux",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
# Upper bounds are deliberate: these decide numeric output, so golden-output parity holds only for the set in uv.lock.
|
|
21
|
+
dependencies = [
|
|
22
|
+
"numpy>=1.26,<3",
|
|
23
|
+
"pysam>=0.22,<0.24",
|
|
24
|
+
"scipy>=1.11,<2",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Documentation = "https://github.com/IceGreb/degrseq/tree/main/specs"
|
|
29
|
+
Repository = "https://github.com/IceGreb/degrseq"
|
|
30
|
+
Issues = "https://github.com/IceGreb/degrseq/issues"
|
|
31
|
+
Changelog = "https://github.com/IceGreb/degrseq/blob/main/CHANGELOG.md"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
degrseq = "degrseq.cli:main"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["hatchling"]
|
|
38
|
+
build-backend = "hatchling.build"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/degrseq"]
|
|
42
|
+
|
|
43
|
+
[tool.hatch.build.targets.sdist]
|
|
44
|
+
exclude = ["/tests", "/specs", "/.github", "/CODE_REVIEW_REPORT.md"]
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = ["pre-commit>=4.0", "pytest>=8.0"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
line-length = 100
|
|
51
|
+
target-version = "py312"
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = ["tests"]
|
|
58
|
+
addopts = "-q"
|