Skill Tracer
Skills › Scientific Agent Skills › gtars › cli.md

cli.md

369 lines · skills/gtars/references/cli.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Command-line interface (`gtars-cli==0.10.0`)
2
3Source-reviewed from the published 0.10.0 crate (commit `90141b6`) on **2026-10-01**.
4Commands below are illustrative templates; this audit did not compile the CLI.
5The package is `gtars-cli`; the installed binary is `gtars`.
6

Command-line interface (gtars-cli==0.10.0)

Source-reviewed from the published 0.10.0 crate (commit 90141b6) on 2026-10-01. Commands below are illustrative templates; this audit did not compile the CLI. The package is gtars-cli; the installed binary is gtars.

Raw lines 1 to 6
7## Trust, installation, and features
8
9Cargo installation compiles native code and may run transitive build scripts.
10Review the official crate/source, lock resolution, license, and build environment
11before:
13```bash
14cargo install gtars-cli --version 0.10.0 --locked
15gtars --version
16gtars --help
17```
19If using a precompiled binary, verify that its version and checksum match the
20reviewed release before extraction or execution. The bundled `artifact_inspector.py` hashes/classifies an
21artifact without extracting or executing it.
23Default CLI features are:
25```text
26scoring uniwig bbcache igd fragsplit overlaprs genomicdist refget
27```
29To build a reduced binary:
31```bash
32cargo install gtars-cli --version 0.10.0 --locked \
33 --no-default-features --features "overlaprs,genomicdist"
34```
36Feature availability controls subcommand availability. There is no 0.10.0 CLI
37`tokenizers` feature/subcommand. Do not copy an old `--all-features` binary's
38command assumptions into a reduced binary.

Trust, installation, and features

Cargo installation compiles native code and may run transitive build scripts. Review the official crate/source, lock resolution, license, and build environment before:

cargo install gtars-cli --version 0.10.0 --locked
gtars --version
gtars --help

If using a precompiled binary, verify that its version and checksum match the reviewed release before extraction or execution. The bundled artifact_inspector.py hashes/classifies an artifact without extracting or executing it.

Default CLI features are:

scoring uniwig bbcache igd fragsplit overlaprs genomicdist refget

To build a reduced binary:

cargo install gtars-cli --version 0.10.0 --locked \
  --no-default-features --features "overlaprs,genomicdist"

Feature availability controls subcommand availability. There is no 0.10.0 CLI tokenizers feature/subcommand. Do not copy an old --all-features binary's command assumptions into a reduced binary.

Raw lines 7 to 39
40## Global behavior
42```bash
43gtars --help
44gtars --version
45gtars <command> --help
46```
48Tagged source defines no global `--threads`, `--memory-limit`, `--buffer-size`,
49`--verbose`, `--quiet`, `--strict`, `--continue-on-error`, or `--log-file`
50options. Concurrency is command-specific.
52Before every real command, run the exact installed `--help`. This reference is
53pinned to 0.10.0; unversioned web documentation can drift.

Global behavior

gtars --help
gtars --version
gtars <command> --help

Tagged source defines no global --threads, --memory-limit, --buffer-size, --verbose, --quiet, --strict, --continue-on-error, or --log-file options. Concurrency is command-specific.

Before every real command, run the exact installed --help. This reference is pinned to 0.10.0; unversioned web documentation can drift.

Raw lines 40 to 54
55## `overlaprs`
57```bash
58gtars overlaprs \
59 --query query.bed \
60 --universe universe.bed \
61 --backend bits
62```
64Options:
66- `-q/--query PATH` (required);
67- `-u/--universe PATH` (required);
68- `-e/--backend bits|ailist` (handler default: `bits`);
69- `--streaming` is parsed but ignored by the v0.10.0 handler.
71Output is BED3 universe-hit coordinates to stdout, one row per overlap. It is not
72a count table and does not retain query IDs. See `overlap.md`.

overlaprs

gtars overlaprs \
  --query query.bed \
  --universe universe.bed \
  --backend bits

Options:

  • -q/--query PATH (required);
  • -u/--universe PATH (required);
  • -e/--backend bits|ailist (handler default: bits);
  • --streaming is parsed but ignored by the v0.10.0 handler.

Output is BED3 universe-hit coordinates to stdout, one row per overlap. It is not a count table and does not retain query IDs. See overlap.md.

Raw lines 55 to 73
74## `igd`
76Create from a **folder** of BED files:
78```bash
79gtars igd create \
80 --filelist approved-bed-directory \
81 --output index-directory \
82 --dbname reference_index
83```
85Search with a BED/BED.GZ query:
87```bash
88gtars igd search \
89 --database index-directory/reference_index.igd \
90 --query query.bed
91```
93Current subcommands are `create` and `search`, not `build`, `query`, or `count`.
94The handler accepts a directory, a `.txt` file of paths, or `-`/`stdin`.
95Directory discovery includes every `.bed` or `.gz` file, so use a reviewed list
96when that would include unrelated gzip files. Create the output directory first.
97`search --database` needs the `.igd` **file**, not its parent directory. Output
98is per-database-file overlap counts plus a total, not row-aligned query matches.

igd

Create from a folder of BED files:

gtars igd create \
  --filelist approved-bed-directory \
  --output index-directory \
  --dbname reference_index

Search with a BED/BED.GZ query:

gtars igd search \
  --database index-directory/reference_index.igd \
  --query query.bed

Current subcommands are create and search, not build, query, or count. The handler accepts a directory, a .txt file of paths, or -/stdin. Directory discovery includes every .bed or .gz file, so use a reviewed list when that would include unrelated gzip files. Create the output directory first. search --database needs the .igd file, not its parent directory. Output is per-database-file overlap counts plus a total, not row-aligned query matches.

Raw lines 74 to 99
100## `uniwig`
102Batch BigWig:
104```bash
105gtars uniwig \
106 --file sorted.bed.gz \
107 --filetype bed \
108 --chromref assembly.chrom.sizes \
109 --smoothsize 5 \
110 --stepsize 1 \
111 --fileheader output/sample_ \
112 --outputtype bw \
113 --counttype core \
114 --threads 4
115```
117BAM QC:
119```bash
120gtars uniwig bamqc \
121 --input aligned.bam \
122 --output bamqc.tsv \
123 --threads 1
124```
126BED streaming adds `--streaming` and supports only WIG/bedGraph output. Read
127`coverage.md` for all flags, sorting/bounds, BAM behavior, and resource limits.

uniwig

Batch BigWig:

gtars uniwig \
  --file sorted.bed.gz \
  --filetype bed \
  --chromref assembly.chrom.sizes \
  --smoothsize 5 \
  --stepsize 1 \
  --fileheader output/sample_ \
  --outputtype bw \
  --counttype core \
  --threads 4

BAM QC:

gtars uniwig bamqc \
  --input aligned.bam \
  --output bamqc.tsv \
  --threads 1

BED streaming adds --streaming and supports only WIG/bedGraph output. Read coverage.md for all flags, sorting/bounds, BAM behavior, and resource limits.

Raw lines 100 to 128
129## `consensus`
131```bash
132gtars consensus \
133 --beds a.bed b.bed c.bed \
134 --min-count 2 \
135 --output consensus.bed
136```
138- `--beds` requires at least two paths;
139- `--min-count` defaults to 1;
140- output defaults to stdout and is BED4 (`chr start end count`).
142Consensus counts input sets overlapping a reduced union component; it is not
143per-base support segmentation. See `overlap.md`.

consensus

gtars consensus \
  --beds a.bed b.bed c.bed \
  --min-count 2 \
  --output consensus.bed
  • --beds requires at least two paths;
  • --min-count defaults to 1;
  • output defaults to stdout and is BED4 (chr start end count).

Consensus counts input sets overlapping a reduced union component; it is not per-base support segmentation. See overlap.md.

Raw lines 129 to 144
145## `ranges`
147`ranges` exposes interval algebra:
149```text
150gtars ranges reduce --input BED [--output OUT]
151gtars ranges trim --input BED --chrom-sizes SIZES [--output OUT]
152gtars ranges promoters --input BED [--upstream 2000] [--downstream 200] [--output OUT]
153gtars ranges setdiff -a BED_A -b BED_B [--output OUT]
154gtars ranges pintersect -a BED_A -b BED_B [--output OUT]
155gtars ranges concat -a BED_A -b BED_B [--output OUT]
156gtars ranges union -a BED_A -b BED_B [--output OUT]
157gtars ranges jaccard -a BED_A -b BED_B
158gtars ranges shift --input BED --offset N [--output OUT]
159gtars ranges flank --input BED --width N [--start|--both] [--output OUT]
160gtars ranges resize --input BED --width N [--fix start|end|center] [--output OUT]
161gtars ranges narrow --input BED [--start N] [--end N] [--width N] [--output OUT]
162gtars ranges disjoin --input BED [--output OUT]
163gtars ranges gaps --input BED --chrom-sizes SIZES [--output OUT]
164gtars ranges intersect -a BED_A -b BED_B [--output OUT]
165```
167Operations without `--output` write to stdout. `promoters` is anchored on region
168starts in core behavior; do not assume strand-aware TSS handling.

ranges

ranges exposes interval algebra:

gtars ranges reduce      --input BED [--output OUT]
gtars ranges trim        --input BED --chrom-sizes SIZES [--output OUT]
gtars ranges promoters   --input BED [--upstream 2000] [--downstream 200] [--output OUT]
gtars ranges setdiff     -a BED_A -b BED_B [--output OUT]
gtars ranges pintersect  -a BED_A -b BED_B [--output OUT]
gtars ranges concat      -a BED_A -b BED_B [--output OUT]
gtars ranges union       -a BED_A -b BED_B [--output OUT]
gtars ranges jaccard     -a BED_A -b BED_B
gtars ranges shift       --input BED --offset N [--output OUT]
gtars ranges flank       --input BED --width N [--start|--both] [--output OUT]
gtars ranges resize      --input BED --width N [--fix start|end|center] [--output OUT]
gtars ranges narrow      --input BED [--start N] [--end N] [--width N] [--output OUT]
gtars ranges disjoin     --input BED [--output OUT]
gtars ranges gaps        --input BED --chrom-sizes SIZES [--output OUT]
gtars ranges intersect   -a BED_A -b BED_B [--output OUT]

Operations without --output write to stdout. promoters is anchored on region starts in core behavior; do not assume strand-aware TSS handling.

Raw lines 145 to 169
170## `fscoring` fragment counts
172File-by-peak matrix:
174```bash
175gtars fscoring "fragments/sample01.fragments.tsv.gz" consensus.bed \
176 --mode chip \
177 --output counts.csv.gz
178```
180Arguments are positional:
182```text
183gtars fscoring <fragments> <consensus> [--mode atac|chip] [--output PATH]
184```
186- `fragments` is interpreted by `FragmentFileGlob`; a single explicit local file
187 is safest. Shell globs can expose unintended files, while quoted globs are
188 expanded by the library.
189- default mode is `atac`;
190- default output is `fscoring.csv.gz`;
191- the shown `chip` mode uses fragment-body overlap semantics, one increment per
192 row/peak overlap; it ignores the fifth fragment-support count;
193- **do not use the default `atac` mode for scientific results in this pin.**
194 The CLI's locked `gtars-scoring 0.5.2` constructs its right-cut query as
195 `[fragment.end - 5, fragment.end - 6)`, an invalid reversed interval; small
196 coordinates can also underflow unsigned arithmetic. This is a source-confirmed
197 correctness issue, not a validated ATAC count implementation. The planner
198 refuses to approve this mode. Use a separately validated cut-site workflow if
199 ATAC insertion counts are required; selecting `chip` changes the measurement.
201Sparse barcode mode:
203```bash
204gtars fscoring sample.fragments.tsv.gz consensus.bed \
205 --barcode \
206 --output output/sample01
207```
209This writes:
211```text
212output/sample01_matrix.mtx.gz
213output/sample01_barcodes.tsv.gz
214output/sample01_features.tsv.gz
215```
217Barcode mode ignores `--mode`: it counts whole-fragment overlaps, increments
218once per row, and ignores the fifth support count. It keeps only barcodes having
219an overlap. The matrix is **cells by peaks**, with lexicographically sorted
220barcodes and 1-based Matrix Market coordinates. Feature labels are synthetic
221`peak_0`, `peak_1`, etc.; retain a separate coordinate table in the constructor's
222sorted consensus order, and reject duplicate consensus intervals. Do not feed it
223into a reader assuming the common peaks-by-cells orientation without transposing.
225The fragment file must carry valid coordinates and barcodes. Do not expose raw
226barcodes in logs or reports; cap cells, peaks, nonzeros, memory, and output.

fscoring fragment counts

File-by-peak matrix:

gtars fscoring "fragments/sample01.fragments.tsv.gz" consensus.bed \
  --mode chip \
  --output counts.csv.gz

Arguments are positional:

gtars fscoring <fragments> <consensus> [--mode atac|chip] [--output PATH]
  • fragments is interpreted by FragmentFileGlob; a single explicit local file is safest. Shell globs can expose unintended files, while quoted globs are expanded by the library.
  • default mode is atac;
  • default output is fscoring.csv.gz;
  • the shown chip mode uses fragment-body overlap semantics, one increment per row/peak overlap; it ignores the fifth fragment-support count;
  • **do not use the default atac mode for scientific results in this pin.** The CLI's locked gtars-scoring 0.5.2 constructs its right-cut query as [fragment.end - 5, fragment.end - 6), an invalid reversed interval; small coordinates can also underflow unsigned arithmetic. This is a source-confirmed correctness issue, not a validated ATAC count implementation. The planner refuses to approve this mode. Use a separately validated cut-site workflow if ATAC insertion counts are required; selecting chip changes the measurement.

Sparse barcode mode:

gtars fscoring sample.fragments.tsv.gz consensus.bed \
  --barcode \
  --output output/sample01

This writes:

output/sample01_matrix.mtx.gz
output/sample01_barcodes.tsv.gz
output/sample01_features.tsv.gz

Barcode mode ignores --mode: it counts whole-fragment overlaps, increments once per row, and ignores the fifth support count. It keeps only barcodes having an overlap. The matrix is cells by peaks, with lexicographically sorted barcodes and 1-based Matrix Market coordinates. Feature labels are synthetic peak_0, peak_1, etc.; retain a separate coordinate table in the constructor's sorted consensus order, and reject duplicate consensus intervals. Do not feed it into a reader assuming the common peaks-by-cells orientation without transposing.

The fragment file must carry valid coordinates and barcodes. Do not expose raw barcodes in logs or reports; cap cells, peaks, nonzeros, memory, and output.

Raw lines 170 to 227
228## `pb` pseudobulk splitting
230The current command name is `pb`, not `fragsplit`:
232```bash
233gtars pb sample.fragments.tsv.gz barcode_to_cluster.tsv \
234 --output pseudobulk-output
235```
237Positional arguments are fragments then mapping; default output is `out/`.
238This writes cluster-specific files. Validate mapping uniqueness, unknown
239barcodes, safe cluster names, output collisions, file-count bounds, and patient
240split policy first.

pb pseudobulk splitting

The current command name is pb, not fragsplit:

gtars pb sample.fragments.tsv.gz barcode_to_cluster.tsv \
  --output pseudobulk-output

Positional arguments are fragments then mapping; default output is out/. This writes cluster-specific files. Validate mapping uniqueness, unknown barcodes, safe cluster names, output collisions, file-count bounds, and patient split policy first.

Raw lines 228 to 241
242## `genomicdist`
244Minimal call:
246```bash
247gtars genomicdist \
248 --bed regions.bed \
249 --chrom-sizes assembly.chrom.sizes \
250 --bins 250 \
251 --output distribution.json
252```
254Optional inputs/features:
256- `--gtf GTF` for partitions and derived TSS distances;
257- `--tss BED` to override GTF-derived TSS;
258- `--signal-matrix TSV`;
259- `--fasta FASTA|FAB` for GC content;
260- `--dinucl-freq` and `--dinucl-raw-counts`;
261- `--ignore-unk-chroms`;
262- `--promoter-upstream`, `--promoter-downstream`;
263- `--compact`.
265Supplying chromosome sizes makes region-distribution bins comparable across
266files and enables bounds-related operations. Omitting them derives scale from
267observed ends and is unsuitable for cross-file comparison.

genomicdist

Minimal call:

gtars genomicdist \
  --bed regions.bed \
  --chrom-sizes assembly.chrom.sizes \
  --bins 250 \
  --output distribution.json

Optional inputs/features:

  • --gtf GTF for partitions and derived TSS distances;
  • --tss BED to override GTF-derived TSS;
  • --signal-matrix TSV;
  • --fasta FASTA|FAB for GC content;
  • --dinucl-freq and --dinucl-raw-counts;
  • --ignore-unk-chroms;
  • --promoter-upstream, --promoter-downstream;
  • --compact.

Supplying chromosome sizes makes region-distribution bins comparable across files and enables bounds-related operations. Omitting them derives scale from observed ends and is unsuitable for cross-file comparison.

Raw lines 242 to 268
269## `prep`
271```text
272gtars prep --gtf genes.gtf.gz [--output genes.gda]
273gtars prep --signal-matrix matrix.tsv.gz [--output matrix.bin]
274gtars prep --fasta reference.fa [--output reference.fab]
275```
277`prep` serializes local inputs into Gtars-specific binary formats. Treat these
278artifacts as versioned native data: hash inputs/outputs, record 0.10.0, reject
279untrusted serialized files, and bound expansion/memory.

prep

gtars prep --gtf genes.gtf.gz [--output genes.gda]
gtars prep --signal-matrix matrix.tsv.gz [--output matrix.bin]
gtars prep --fasta reference.fa [--output reference.fab]

prep serializes local inputs into Gtars-specific binary formats. Treat these artifacts as versioned native data: hash inputs/outputs, record 0.10.0, reject untrusted serialized files, and bound expansion/memory.

Raw lines 269 to 280
281## `refget`
283```bash
284gtars refget build reference.fa reference-alt.fa.gz \
285 --output refget-store \
286 --jobs 1
287```
289Other options include `--file-list/-f`, `--raw`, `--force`,
290`--collection-alias NAMESPACE:ALIAS` (one FASTA only), and
291`--lock-timeout SECONDS` (default 1800; 0 waits indefinitely).
292`--jobs 0` means automatic concurrency. Version 0.10.0 also provides:
294```bash
295gtars refget lock-status refget-store
296gtars refget export --store refget-store --collection local:reference \
297 --names chr1 --output chr1.fa.gz --line-width 80
298```
300Export accepts a digest or collection alias; without `--collection` the store
301must contain exactly one collection. It loads the selected sequence bytes into
302RAM and overwrites the output path; bound selection and check output collisions.
303`.gz` enables gzip and line width 0 disables wrapping. `--force-alias` overwrites
304conflicting aliases; `--force-unlock` bypasses a writer lock and must never be
305used to solve normal contention from a live process. There are no `digest`,
306`verify`, or remote-query subcommands. See `refget.md`.

refget

gtars refget build reference.fa reference-alt.fa.gz \
  --output refget-store \
  --jobs 1

Other options include --file-list/-f, --raw, --force, --collection-alias NAMESPACE:ALIAS (one FASTA only), and --lock-timeout SECONDS (default 1800; 0 waits indefinitely). --jobs 0 means automatic concurrency. Version 0.10.0 also provides:

gtars refget lock-status refget-store
gtars refget export --store refget-store --collection local:reference \
  --names chr1 --output chr1.fa.gz --line-width 80

Export accepts a digest or collection alias; without --collection the store must contain exactly one collection. It loads the selected sequence bytes into RAM and overwrites the output path; bound selection and check output collisions. .gz enables gzip and line width 0 disables wrapping. --force-alias overwrites conflicting aliases; --force-unlock bypasses a writer lock and must never be used to solve normal contention from a live process. There are no digest, verify, or remote-query subcommands. See refget.md.

Raw lines 281 to 307
308## `bbcache`
310```text
311gtars bbcache cache-bed --identifier VALUE [--cache-folder DIR]
312gtars bbcache cache-bedset --identifier VALUE [--cache-folder DIR]
313gtars bbcache seek --identifier VALUE [--cache-folder DIR]
314gtars bbcache inspect-bedfiles [--cache-folder DIR]
315gtars bbcache inspect-bedsets [--cache-folder DIR]
316gtars bbcache rm --identifier VALUE [--cache-folder DIR]
317```
319Client construction creates cache directories. Cache/download calls can contact
320BEDbase or arbitrary URL hosts and write SQLite/cache files. `rm` deletes local
321content. The tagged source has a likely ID-only download mismatch described in
322`refget.md`; do not guess a workaround.

bbcache

gtars bbcache cache-bed       --identifier VALUE [--cache-folder DIR]
gtars bbcache cache-bedset    --identifier VALUE [--cache-folder DIR]
gtars bbcache seek            --identifier VALUE [--cache-folder DIR]
gtars bbcache inspect-bedfiles                 [--cache-folder DIR]
gtars bbcache inspect-bedsets                  [--cache-folder DIR]
gtars bbcache rm              --identifier VALUE [--cache-folder DIR]

Client construction creates cache directories. Cache/download calls can contact BEDbase or arbitrary URL hosts and write SQLite/cache files. rm deletes local content. The tagged source has a likely ID-only download mismatch described in refget.md; do not guess a workaround.

Raw lines 308 to 323
324## Threading and resource controls
326There is no global thread flag:
328- batch uniwig `--threads/-p` defaults to 6;
329- `uniwig bamqc --threads/-t` defaults to 1; values above 1 need a BAM index;
330- `refget build --jobs/-j` defaults to 0 (auto);
331- other commands expose no documented thread setting.
333Set command-specific values explicitly. Also bound input bytes/records/files,
334glob matches, hit pairs/nonzeros, stdout, memory, temporary disk, cache, and
335wall time externally.

Threading and resource controls

There is no global thread flag:

  • batch uniwig --threads/-p defaults to 6;
  • uniwig bamqc --threads/-t defaults to 1; values above 1 need a BAM index;
  • refget build --jobs/-j defaults to 0 (auto);
  • other commands expose no documented thread setting.

Set command-specific values explicitly. Also bound input bytes/records/files, glob matches, hit pairs/nonzeros, stdout, memory, temporary disk, cache, and wall time externally.

Raw lines 324 to 336
337## Safe dry-run planning
339```bash
340python3 -B scripts/execution_plan.py --help
341python3 -B scripts/coverage_preflight.py --help
342```
344These helpers produce fixed argv templates only. They do not invoke `gtars`,
345expand globs, download data, create caches, or write outputs.

Safe dry-run planning

python3 -B scripts/execution_plan.py --help
python3 -B scripts/coverage_preflight.py --help

These helpers produce fixed argv templates only. They do not invoke gtars, expand globs, download data, create caches, or write outputs.

Raw lines 337 to 346
Runs code scripts/execution_plan.py :340
Runs code scripts/coverage_preflight.py :341
347## Removed stale command forms
349Do not use:
351```text
352gtars igd build/query/count
353gtars overlaprs overlap/count/filter/subtract
354gtars uniwig generate
355gtars scoring score/batch
356gtars fragsplit split/cluster-split/filter
357gtars refget digest/verify
358gtars --threads/--memory-limit/--verbose
359```

Removed stale command forms

Do not use:

gtars igd build/query/count
gtars overlaprs overlap/count/filter/subtract
gtars uniwig generate
gtars scoring score/batch
gtars fragsplit split/cluster-split/filter
gtars refget digest/verify
gtars --threads/--memory-limit/--verbose
Raw lines 347 to 360
361## Official sources (accessed 2026-10-01)
363- [gtars-cli 0.10.0 crate](https://crates.io/crates/gtars-cli)
364- [Gtars v0.10.0 release](https://github.com/databio/gtars/releases/tag/gtars-v0.10.0)
365- [CLI main parser at v0.10.0](https://github.com/databio/gtars/blob/gtars-v0.10.0/gtars-cli/src/main.rs)
366- [Locked scoring implementation](https://github.com/databio/gtars/blob/gtars-v0.10.0/gtars-scoring/src/fragment_scoring.rs)
367- [CLI feature manifest at v0.10.0](https://github.com/databio/gtars/blob/gtars-v0.10.0/gtars-cli/Cargo.toml)
368- [Official CLI guide](https://docs.bedbase.org/gtars/cli/)
369- [Official versioning policy](https://docs.bedbase.org/gtars/versioning/)