lib

package
v0.0.0-...-95e9d17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright © 2023 Christian Diener <mail(a)cdiener.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLineage

func AddLineage[K any](taxids map[string]K, data_dir string, format string) map[string]*Lineage

func Confidence

func Confidence(abundances map[string]uint32, classification string) float64

func CountLines

func CountLines(path string) (int, error)

Count the number of lines in a file

func Entropy

func Entropy(abundances map[string]uint32) float64

func FilterReads

func FilterReads(k2path string, out string, data_dir string,
	format string, named bool, min_consistency float64, max_entropy float64, max_multiplicity uint32) error

func GetFormat

func GetFormat(filename string) (string, bool)

func GetLeaf

func GetLeaf(lin *Lineage) (int, string)

func GetRanks

func GetRanks(format string) []string

func HasTaxonkit

func HasTaxonkit() (string, bool)

func Multiplicity

func Multiplicity(abundances map[string]uint32) uint32

func ParseMapping

func ParseMapping(k2map Mapping, line string, named bool) error

func SampleAppend

func SampleAppend(files []string, out string, sep rune) error

func SaveMapping

func SaveMapping(k2map Mapping, filepath string, sample_id string) error

func ScoreReadsToFile

func ScoreReadsToFile(k2path string, out string, data_dir string, format string, named bool) error

func SimpleAppend

func SimpleAppend(files []string, out string, header bool) error

func TaxID

func TaxID(token string, named bool) string

func TaxonDB

func TaxonDB(filepath string, data_dir string, format string, named bool) (map[string]*Lineage, int)

func UpdateMapping

func UpdateMapping(entry *Taxon, kmer_taxid string, count int)

Types

type Lineage

type Lineage struct {
	Names  []string
	Taxids []string
}

type Mapping

type Mapping map[string]*Taxon

func CollapseRanks

func CollapseRanks(k2map Mapping, data_dir string, format string) Mapping

func SummarizeKmers

func SummarizeKmers(filepath string, named bool) (Mapping, error)

Summarize combines

type Node

type Node struct {
	Taxid    int
	Name     string
	Parent   *Node
	Children []*Node
	Value    float64
}

type ReadScore

type ReadScore struct {
	TaxonName    string
	TaxonID      uint32
	ID           string
	Kmers        uint32
	Consistency  float64
	Confidence   float64
	Multiplicity uint32
	Entropy      float64
}

func ScoreRead

func ScoreRead(line string, taxondb map[string]*Lineage, named bool) *ReadScore

type Taxon

type Taxon struct {
	Lineage string
	Reads   int
	Classes map[string]int
}

type Tree

type Tree struct {
	Root     *Node
	Taxids   map[int]*Node
	Children []*Node
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL