Skip to content

# select

Project and/or aggregate the genome columns of an index into a new (or in-place) index. Where `filter` selects rows (kmers), `select` operates on columns (genomes): grouping several genomes into one aggregated column, reordering columns, or dropping some.

    obikmer select SOURCE (--output OUTPUT | --in-place) [OPTIONS]

## Arguments

Argument | Description
--- | ---
`SOURCE` | Source index directory

## Options

Option | Default | Description
--- | --- | ---
`--output` | — | Output index directory (mutually exclusive with `--in-place`)
`--in-place` | off | Rewrite the source index in place (mutually exclusive with `--output`)
`-f, --force` | off | Overwrite an existing output directory
`--group NAME:PRED` | none | Define a named group of genomes by predicate (repeatable; mutually exclusive with `--aggregate-by`)
`--group-op NAME:OP` | none | Aggregation operator for a named group
`--aggregate-by KEY` | none | Automatically create one group per distinct value of a metadata key (mutually exclusive with `--group`)
`--aggregate-op OP` | none | Aggregation operator applied to every auto-generated group
`--select COL,...` | all columns | Output columns, in order (group names or genome labels)
`--presence-threshold` | `0` | Minimum count for a genome to be considered a carrier (logical operators only)

## Aggregation operators

`any`, `all`, `none` (logical, evaluated against `--presence-threshold`), `sum`, `min`, `max` (numeric, count index only). If a group's operator is left unspecified, it defaults to `any` when the source is a presence/absence index and `sum` when it stores counts.

A `select` never changes the underlying kmer set — only the per-genome data (counts or presence) is rewritten, so an unaggregated pass-through column (a plain genome label in `--select`) is a cheap copy.

At least one of `--output`/`--in-place` is required, and at least one output column must be defined; every name listed in `--select` must resolve to either a defined group or an existing genome label. See Genome predicates and taxonomy paths for the predicate syntax used by `--group`.