Documentation
¶
Index ¶
Constants ¶
const AMRFileName = "amrfinderplus.parquet"
AMRFileName is the single merged parquet file containing all AMR data.
const PartitionDir = "amr"
PartitionDir is the subdirectory under the data dir where genus partitions live.
const PartitionThreshold = 10_000
PartitionThreshold is the minimum number of rows a genus must have to get its own partition file. Genera below this threshold are grouped into _other.parquet.
Variables ¶
This section is empty.
Functions ¶
func BuildIndexes ¶
BuildIndexes reads each .parquet file in the partition directory and builds a corresponding .sqlite index. Builds run in parallel (one goroutine per file, bounded by NumCPU).
func BuildPartitions ¶
BuildPartitions reads the monolithic amrfinderplus.parquet and writes per-genus partition files into <dataDir>/amr/. Uses a streaming two-pass approach:
- First pass: count rows per genus (reads only Genus column equivalent).
- Second pass: stream rows into per-genus writers, routing small genera to _other.
logFn is called with progress messages (pass nil to suppress output).
func PartitionPath ¶
PartitionPath returns the path to a genus partition file if it exists. Returns empty string if the partition doesn't exist.
Types ¶
type Filters ¶
type Filters struct {
// Samples restricts results to a specific set of sample accessions.
// Nil or empty means no restriction.
Samples map[string]struct{}
// Class filters by drug class (case-insensitive substring match). Empty means all.
Class string
// GenePattern filters by gene symbol. Supports % wildcards (prefix/suffix/contains). Empty means all.
GenePattern string
// MinCoverage is the minimum coverage percentage (0 = no minimum).
MinCoverage float64
// MinIdentity is the minimum identity percentage (0 = no minimum).
MinIdentity float64
// ElementType restricts to a specific element type ("AMR", "STRESS", "VIRULENCE"). Empty means all.
ElementType string
// Genera restricts results to specific bacterial genera (case-insensitive).
// Nil or empty means all genera (full scan).
Genera []string
// Species restricts results to specific full species names, e.g. "Escherichia coli"
// (case-insensitive exact match against the row's Species field).
// Nil or empty means no species-level restriction.
Species []string
// Limit caps the number of returned results. 0 means no limit.
Limit int
}
Filters controls which AMR rows are returned by Query.
type Result ¶
type Result struct {
SampleAccession string
GeneSymbol string
ElementType string
ElementSubtype string
Coverage float64
Identity float64
Method string
Class string
Subclass string
Species string
Genus string
}
Result is a single AMR gene hit associated with a sample.