rsomics-fastq-downsample 0.1.2

Deterministic random downsampling of FASTQ to a target read count or fraction
Documentation
# rsomics-fastq-downsample

Deterministic random downsampling of a FASTQ file to a target fraction of its
reads. Each read is kept by an independent Bernoulli trial seeded by `--seed`,
so a given seed and fraction always select the same reads.

## Install

```
cargo install rsomics-fastq-downsample
```

## Usage

```
# keep ~10% of reads, reproducibly
rsomics-fastq-downsample reads.fq -f 0.1 --seed 42 -o sub.fq

# keep half the reads
rsomics-fastq-downsample reads.fq -f 0.5 --seed 7

# fraction 1.0 keeps everything (still streams through the sampler)
rsomics-fastq-downsample reads.fq -f 1.0 --seed 1 -o out.fq
```

- `-f, --fraction` — fraction of reads to keep, `0.0`-`1.0` (default `0.1`).
- `-o, --output` — output path (`-` = stdout).
- `--seed` — RNG seed for reproducible selection.

This is a per-read Bernoulli sampler: the number of surviving reads is close to
`fraction x N` but not exactly fixed. For an exact target count use
`rsomics-fastq-sample -n`.

## Origin

Independent Rust reimplementation of fraction-based FASTQ downsampling as done
by `seqtk sample` and `seqkit sample -p`, based on the tools' documented
behaviour and black-box comparison: with the same fraction the retained-read
count is comparable to both upstreams (an independent RNG cannot reproduce the
exact reads either tool selects, so agreement is at the fraction level, not
byte-for-byte). Test fixtures are independently generated.

License: MIT OR Apache-2.0.
Upstream credit: [seqtk](https://github.com/lh3/seqtk) (MIT),
[seqkit](https://github.com/shenwei356/seqkit) (MIT).