Invntr
Source

All instruments

kmer_spectrum

k-mer counting on DNA reads or one sequence (canonical or not, linear or circular): spectrum histogram, distinct and unique k-mers, Shannon entropy, linguistic complexity, genome-size estimate from the spectrum peak, most over-represented k-mers against a base-composition model. Reads from a list, FASTA/FASTQ text, a staged file, or a seeded shotgun simulator.

Field
Genomics
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
1 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replaykmer_spectrum 0.1.0 · files 68dd151a9fc6…3df7
  1. r0001homopolymer A x 50, k = 5 (closed form): one distinct k-mer counted L - k + 1 = 46 times, entropy 0, linguistic complexity 5/161 (Trifonov, sum of min(4^w, L - w + 1) over w = 1..5 is 161)passed

    total_kmers= 4646lockedexact match
    distinct_kmers= 11lockedexact match
    max_multiplicity= 4646lockedexact match
    unique_kmers= 00lockedexact match
    entropy_bits0 ± 1e-120lockedunder 0.01 % of the tolerance used
    linguistic_complexity0.0310559 ± 3.1e-110.0310559lockedunder 0.01 % of the tolerance used
  2. r0002de Bruijn B(4,3) read cyclically, k = 3 (de Bruijn 1946): every one of 4^3 = 64 k-mers exactly once, entropy 2k = 6 bits, linguistic complexity 1passed

    total_kmers= 6464lockedexact match
    distinct_kmers= 6464lockedexact match
    unique_kmers= 6464lockedexact match
    max_multiplicity= 11lockedexact match
    entropy_bits6 ± 6e-126lockedunder 0.01 % of the tolerance used
    entropy_relative1 ± 1e-121lockedunder 0.01 % of the tolerance used
    linguistic_complexity1 ± 1e-121lockedunder 0.01 % of the tolerance used
  3. r0003total k-mers = sum (L_i - k + 1) (counting identity): lengths 10, 25, 7, 3 at k = 4 give 7 + 22 + 4 + 0 = 33, one sequence shorter than kpassed

    windows= 3333lockedexact match
    total_kmers= 3333lockedexact match
    short_sequences= 11lockedexact match
    total_bases= 4545lockedexact match
  4. r0004canonical merge (Watson-Crick pairing): AAACG and its reverse complement CGTTT are one canonical 5-mer seen twice; 4^5/2 = 512 canonical 5-mers possiblepassed

    total_kmers= 22lockedexact match
    distinct_kmers= 11lockedexact match
    max_multiplicity= 22lockedexact match
    possible_kmers= 512512lockedexact match
    entropy_bits0 ± 1e-120lockedunder 0.01 % of the tolerance used
  5. r0005same pair not canonical: AAACG and CGTTT stay two k-mers, entropy log2 2 = 1 bit, 4^5 = 1024 possiblepassed

    distinct_kmers= 22lockedexact match
    unique_kmers= 22lockedexact match
    possible_kmers= 10241024lockedexact match
    entropy_bits1 ± 1e-121lockedunder 0.01 % of the tolerance used
  6. r0006even-k palindrome ACGT is its own reverse complement: one canonical 4-mer; (4^4 + 4^2)/2 = 136 canonical 4-mers possible (palindrome count 4^(k/2))passed

    total_kmers= 11lockedexact match
    distinct_kmers= 11lockedexact match
    possible_kmers= 136136lockedexact match
  7. r0007genome size from the spectrum peak (exact construction): circular B(4,3) genome G = 64 bp read 3 times plus one circular error read ACGTA whose five 5-mers are absent from the genome; k = 5 gives peak 3, error k-mers 5, G = 192/3 = 64passed

    total_kmers= 197197lockedexact match
    distinct_kmers= 6969lockedexact match
    unique_kmers= 55lockedexact match
    error_kmers= 55lockedexact match
    peak_multiplicity= 33lockedexact match
    solid_kmer_occurrences= 192192lockedexact match
    genome_size_estimate_bp64 ± 6.4e-1164lockedunder 0.01 % of the tolerance used
    coverage_peak_found= truetruelockedexact match
7 of 7 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
k121Word length in bases (packed two bits per base, so at most 31). 21 is usual for read sets.
canonicaltrueCount a k-mer and its reverse complement as one (reads from both strands).
circularfalseRead every sequence as a circle: L windows instead of L - k + 1 (plasmids, de Bruijn sequences).
sequencesReads or sequences as strings of A, C, G, T (U read as T; N and IUPAC codes break the k-mers that span them).
sequence_textFASTA ('>' headers), FASTQ (four lines per read) or one read per line.
sequence_fileStaged FASTA, FASTQ or one-read-per-line file, e.g. "@r0003/reads.fa".
top_n110How many of the most frequent k-mers to list.
min_multiplicity10k-mers seen fewer times are treated as sequencing errors; 0 finds the error valley of the spectrum.
sim_genome_bp10Length in base pairs of a simulated random circular genome; 0 turns the simulator off. Use it instead of giving sequences.
sim_read_bp1150Simulated read length in base pairs.
sim_coverage130.0Read bases over genome bases.
sim_error_rate10.0Chance that a simulated base is read wrong (uniform substitution).
sim_seed11Seed of the SplitMix64 draws: the same seed gives the same reads.
sim_both_strandstrueHalf the simulated reads come from the reverse strand.

Readings

NameUnitMeaning
k1
sequences1
total_bases1bases read (base pairs)
gc_fraction1
windows1sum over sequences of L - k + 1 (L when circular)
total_kmers1windows counted (those with no ambiguous base)
skipped_kmers1
short_sequences1
possible_kmers14^k, or the canonical count (4^k + 4^(k/2))/2 for even k and 4^k/2 for odd k
distinct_kmers1
unique_kmers1k-mers seen exactly once
unique_fraction1
max_multiplicity1
mean_multiplicity1
entropy_bits1Shannon entropy of the k-mer distribution, bits
entropy_relative1entropy over log2(min(possible, total))
vocabulary_usage1distinct over min(possible, total) at word length k
linguistic_complexity1Trifonov: sum of distinct words over sum of min(possible, windows), word lengths 1..k
error_cutoff_multiplicity1
error_kmers1
distinct_solid_kmers1
solid_kmer_occurrences1
peak_multiplicity1k-mer depth at the spectrum peak
peak_distinct_kmers1
coverage_peak_foundtrue when the spectrum (above the error cutoff) peaks at multiplicity 2 or more
genome_size_estimate_bp1solid k-mer occurrences over peak multiplicity, base pairs
top_kmers
spectrum
simulation

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call