Repository navigation
Statistics
Run stats when you need to understand the indexed collection, not just count records. It combines index metadata with a complete bounded scan of the indexed sequence spans.
z-fasta stats genome.faAn existing .zfi or .fai is required.
- FASTA path.
- Selected sidecar path.
- FASTA size in bytes.
- Indexed record count.
- Total symbols.
- Shortest and longest length and identifier.
- Integer mean.
- Q1, median, and Q3.
- Range.
- N50 and L50.
- N90 and L90.
- auN with two decimal places.
- Nucleotide or protein type.
- Complete category counts and percentages.
- Lowercase count.
- Nucleotide GC and GC skew where defined.
Stats describes the records in the selected index. z-fasta indexes every non-empty record, duplicate identifiers included. A .fai from samtools leaves out later duplicates, so compare reports built from the same kind of index.
Important
Run validate when you need source-header duplicate or empty-record reporting. Stats intentionally reports the indexed population.
- Ties for shortest and longest keep the first indexed record.
- Mean uses integer division.
- Even-count median uses the midpoint rounded down.
- Q1 and Q3 are medians of the lower and upper halves.
- Nx accumulation sorts lengths from longest to shortest and stops at the requested percentage of total symbols.
- auN is
sum(length * length) / total_symbols.
The implementation uses checked u64 totals and u128 intermediate arithmetic for large assemblies.
Stats counts the complete indexed symbol population and classifies it as nucleotide when case-insensitive IUPAC nucleotide symbols are strictly more than 90 percent of all symbols.
The nucleotide set includes:
A C G T U R Y S W K M B D H V N
Empty samples classify as nucleotide, though a production index contains no empty records.
Type labels distinguish:
-
nucleotide_t: T present, U absent. -
nucleotide_u: U present, T absent. -
nucleotide_mixed_tu: both T and U present. -
nucleotide: neither T nor U present.
Fields include A, C, G, T, U, N, combined IUPAC ambiguity, invalid symbols, and lowercase.
Category percentages use total_symbols as denominator. GC percent uses canonical A + C + G + T + U as denominator. GC is n/a when that denominator is zero. GC skew is (G - C) / (G + C) and is n/a when G + C is zero.
Protein output includes:
- 20 standard residues;
- B, Z, J, and X ambiguity or unknown codes;
- U selenocysteine;
- O pyrrolysine;
- stop
*; - invalid symbols;
- lowercase symbols.
Percentages use total_symbols.
.zfi and .fai report equal biological values when both represent the same retained uniform records. .zfi also supports non-uniform records through side tables.
Stats validates that counted symbols equal the index-derived total. A mismatch fails instead of printing a plausible but inconsistent report.
z-fasta stats assembly-a.fa > assembly-a.stats.txt
z-fasta stats assembly-b.fa > assembly-b.stats.txt
diff -u assembly-a.stats.txt assembly-b.stats.txtPaths and file sizes differ by design. The text report is human-readable and does not yet define a stable machine schema. If you parse it in automation, pin the z-fasta version and treat label changes as compatibility work.
z-fasta v0.4.0 | Home | Quick start | Cheat sheet | Troubleshooting | Releases | MIT License
z-fasta Wiki
Start
Use z-fasta
Understand behavior
- Index formats
- Coordinates and names
- Limits and supported formats
- Performance and correctness
- Tool comparison
Solve a problem
Contribute