blast

package module
v2.5.1-0...-7067d9e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AZqseqid = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["qseqid"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "qseqid"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a < b
}

Closures that order the Change structure.

View Source
var AZsseqid = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["sseqid"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "sseqid"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a < b
}
View Source
var Closures = map[string]func(*row, *row) bool{
	"qseqid":  AZqseqid,
	"sseqid":  AZsseqid,
	"Length":  DecLength,
	"length":  IncLength,
	"Pident":  DecPident,
	"Qcovhsp": DecQcovhsp,
	"evalue":  IncEvalue,
	"sstart":  IncSstart,
	"Sstart":  DecSstart,
	"qstart":  IncQstart,
	"Qstart":  DecQstart,
}

Lists the different functions to sort our table. We use the following naming convention : names should be the same has the different column names. To sort values decreasingly, we capitalize the first letter, if available

View Source
var DecLength = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["length"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "length"))
	}
	a, _ := c1.data[i].(int)
	b, _ := c2.data[i].(int)
	return a > b
}
View Source
var DecPident = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["pident"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "pident"))
	}
	a, _ := c1.data[i].(float64)
	b, _ := c2.data[i].(float64)
	return a > b
}
View Source
var DecQcovhsp = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["qcovhsp"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "qcovhsp"))
	}
	a, _ := c1.data[i].(float64)
	b, _ := c2.data[i].(float64)
	return a > b
}
View Source
var DecQstart = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["qstart"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "qstart"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a > b
}
View Source
var DecSstart = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["sstart"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "sstart"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a > b
}
View Source
var IncEvalue = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["evalue"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "evalue"))
	}
	a, _ := c1.data[i].(float64)
	b, _ := c2.data[i].(float64)
	return a < b
}
View Source
var IncLength = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["length"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "length"))
	}
	a, _ := c1.data[i].(int)
	b, _ := c2.data[i].(int)
	return a < b
}
View Source
var IncQstart = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["qstart"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "qstart"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a < b
}
View Source
var IncSstart = func(c1, c2 *row) bool {
	i, ok := (*c1.index)["sstart"]
	if !ok {
		panic(fmt.Sprintf("Oups! Somehow we got a sort parameter for column %v, but no such columns in file!", "sstart"))
	}
	a, _ := c1.data[i].(string)
	b, _ := c2.data[i].(string)
	return a < b
}
View Source
var Query = func(c1, c2 *aln) bool {
	return c1.Query < c2.Query
}
View Source
var QueryEnd = func(c1, c2 *aln) bool {
	return c1.Qend < c2.Qend
}
View Source
var QueryStart = func(c1, c2 *aln) bool {
	return c1.Qstart < c2.Qstart
}
View Source
var Subject = func(c1, c2 *aln) bool {
	return c1.Subject < c2.Subject
}
View Source
var SubjectEnd = func(c1, c2 *aln) bool {
	return c1.Send < c2.Send
}
View Source
var SubjectStart = func(c1, c2 *aln) bool {
	return c1.Sstart < c2.Sstart
}

Functions

func ExtractBest

func ExtractBest(bs Blast, p float64, fKing, fNames string) (Blast, Duplicated, error)

func ListSortClosures

func ListSortClosures(s string) ([]lessFunc, error)

func OrderMatchBy

func OrderMatchBy(less ...matchLessFunc) *matchSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func OrderedBy

func OrderedBy(less []lessFunc) *multiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

Types

type Blast

type Blast struct {
	// contains filtered or unexported fields
}

The main struct to describe the Blast result data table Consists of a list of `columns` names, and the actual `data` table

func LoadBlast

func LoadBlast(file string, c []string) (Blast, error)

func (Blast) ExtractGenomes

func (bs Blast) ExtractGenomes() (map[string]map[string]bool, error)

func (Blast) GetMatchedRegions

func (b Blast) GetMatchedRegions(min int) (Match, error)

Extracts matched regions from the blast results If alignment length is lower than min, aln is ignored

func (Blast) GetPangenome

func (b Blast) GetPangenome(t pangenome.Taxids, core, acc float64, k, s string) (pangenome.Pangenome, error)

func (Blast) Pretty

func (b Blast) Pretty(nb int)

func (Blast) ReorderFna

func (b Blast) ReorderFna(fna, prefix string) error

func (Blast) Write

func (b Blast) Write(d, o string) error

type Duplicated

type Duplicated [][]*row

func (Duplicated) PrintDup

func (d Duplicated) PrintDup()

func (Duplicated) Write

func (d Duplicated) Write(dir, o string) error

type Match

type Match []aln

func (Match) GetOverlap

func (m Match) GetOverlap(name string, gap int) (OverlapMap, OverlapMap)

type Overlap

type Overlap struct {
	Name    string
	Regions []region
	Gaps    []int // Space between overlapping regions
}

func (Overlap) Csv

func (o Overlap) Csv()

Prints to Stdout all the indidual regions, one per line, csv format with header

func (Overlap) GetInfo

func (o Overlap) GetInfo()

func (Overlap) GetStats

func (o Overlap) GetStats()

Prints to Stdout some statistics about our overlaps

type OverlapMap

type OverlapMap map[string]map[string]Overlap

Map linking query and subject and pointing to Match struct

func (OverlapMap) NewEntry

func (m OverlapMap) NewEntry(a aln, o Overlap, name string)

Jump to

Keyboard shortcuts

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