antha: github.com/antha-lang/antha/antha/AnthaStandardLibrary/Packages/search Index | Files

package search

import "github.com/antha-lang/antha/antha/AnthaStandardLibrary/Packages/search"

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Package search is a utility package providing functions useful for: Searching for a target entry in a slice; Removing duplicate values from a slice; Comparing the Name of two entries of any type with a Name() method returning a string. FindAll instances of a target string within a template string.

Index

Package Files

EqualName.go InInts.go InSequences.go InStrings.go Option.go findAll.go plates.go removeDuplicates.go

func BinarySearchInts Uses

func BinarySearchInts(list []int, target int) bool

BinarySearchInts searchs for an int in a slice of ints using a binary search algorithm.

func CheckArrayType Uses

func CheckArrayType(elements []interface{}) (typeName string, err error)

CheckArrayType reflects the type name as a string of all elements in a slice of interface values. If all values in the slice are not of the same type an error is returned.

func ContainsAllStrings Uses

func ContainsAllStrings(template string, targets []string, options ...Option) (trueornot bool)

ContainsAllStrings searches for all instances of a slice of target strings in a template string. Not perfect yet! issue with byte conversion of certain characters! If all items are present, true is returned. If the IgnoreCase option is specified the strings will be compared ignoring case.

func ContainsEqualFold Uses

func ContainsEqualFold(str, substr string) bool

ContainsEqualFold performs case insensitive evaluation of whether the substr value is present in str. The strings will both be trimmed of leading and trailing space prior to evaluation.

func EqualFold Uses

func EqualFold(a, b string) bool

EqualFold performs case insensitive evaluation of the equality of two strings. The strings will both be trimmed of leading and trailing space prior to evaluation.

func EqualName Uses

func EqualName(entry, target Named, options ...Option) bool

EqualName evaluates whether two arguments with a Name() method have equal names. If the IgnoreCase option is specified the strings will be compared ignoring case.

func FindAll Uses

func FindAll(template string, target string, options ...Option) (positions []int)

FindAll searches for all instances of a target string in a template string. Not perfect yet! issue with byte conversion of certain characters! This returns positions in "HumanFriendly" format (i.e. the first position of the sequence will be 1 not 0) If the IgnoreCase option is specified the strings will be compared ignoring case.

func InInts Uses

func InInts(list []int, target int) bool

InInts searchs for an int in a slice of ints

func InSequences Uses

func InSequences(seqs []wtype.DNASequence, seq wtype.DNASequence, options ...Option) (bool, []int)

InSequences searches the positions of any matching instances of a sequence in a slice of sequences. By default, only the sequence will be checked; if MatchName is included as an option, only name must match. If IgnoreCase is added as an option the case will be ignored.

func InStrings Uses

func InStrings(list []string, target string, options ...Option) bool

InStrings searchs for a target string in a slice of strings and returns a boolean. If the IgnoreCase option is specified the strings will be compared ignoring case.

func IsFreeWell Uses

func IsFreeWell(plate *wtype.Plate, well string) error

IsFreeWell checks for whether a well on a plate is free. An error is returned if the well is not found on the plate or is occupied.

func NextFreeWell Uses

func NextFreeWell(plate *wtype.Plate, avoidWells []string, preferredWells []string, byRow bool, options ...Option) (well string, err error)

NextFreeWell checks for the next well which is empty in a plate. The user can also specify wells to avoid, preffered wells and whether to search through the well positions by row. The default is by column. If the SkipAlternateWells option is used we'll skip every other well. This is designed to support multichannelling when a plate has 16 rows (i.e. 384 well plate) when using a fixed 8 channel pipette head.

func PartialInStrings Uses

func PartialInStrings(list []string, target string, options ...Option) bool

PartialInStrings seaches for a target string in a slice of strings and returns a boolean. True is returned if the target is a subset of a value in the slice of strings (i.e. value "foobar", target "bar" will return True). If the IgnoreCase option is specified the strings will be compared ignoring case.

func PositionsInInts Uses

func PositionsInInts(list []int, target int) []int

PositionsInInts searchs for a target int in a slice of ints and returns all positions found.

func PositionsInStrings Uses

func PositionsInStrings(list []string, target string, options ...Option) []int

PositionsInStrings searchs for a target string in a slice of strings and returns all positions found. If the IgnoreCase option is specified the strings will be compared ignoring case.

func RemoveDuplicateFloats Uses

func RemoveDuplicateFloats(elements []float64) []float64

RemoveDuplicateFloats removes all duplicate values encountered in a slice of floats. No precision is specified to floats must be exact matches in order to be considered duplicates.

func RemoveDuplicateInts Uses

func RemoveDuplicateInts(elements []int) []int

RemoveDuplicateInts removes all duplicate values in a slice of ints.

func RemoveDuplicateSequences Uses

func RemoveDuplicateSequences(elements []wtype.DNASequence, options ...Option) []wtype.DNASequence

RemoveDuplicateSequences checks for exact sequence matches only and by default will ignore the name. If MatchName option is added, only sequences with duplicate names will be removed. If IgnoreCase is included as an option, case insensitive name comparison will be used. Sequence comparison will always be case insensitive Any leading or traling space is always removed before comparing elements.

func RemoveDuplicateStrings Uses

func RemoveDuplicateStrings(elements []string, options ...Option) []string

RemoveDuplicateStrings removes all duplicate values in a slice of strings. If IgnoreCase is included as an option, case insensitive comparison will be used. Any leading or traling space is always removed before comparing elements.

func RemoveDuplicateValues Uses

func RemoveDuplicateValues(elements []interface{}) ([]interface{}, error)

RemoveDuplicateValues removes duplicate values of an input slice of interface values and returns all unique entries in slice, preserving the order of the original slice an error will be returned if length of elements is 0

type InvalidWell Uses

type InvalidWell string

InvalidWell is an error type for when an well is requested from a plate which is invalid.

func (InvalidWell) Error Uses

func (err InvalidWell) Error() string

Error returns an error message.

type Named Uses

type Named interface {
    Name() string
}

Named is an interface for any typed value which has a method to return the Name as a string.

type Option Uses

type Option string

Option is an option which can be used as an argument to search functions. Particularly InStrings, InSequences, RemoveDuplicateStrings, RemoveDuplicateSequences.

const (

    // IgnoreCase is an option which can be added to the InStrings and InSequences
    // functions to search ignoring case.
    //
    IgnoreCase Option = "IgnoreCase"

    // MatchName is an option which can be added to the InSequences
    // functions to specify that the name must also be matched.
    // By default sequence searches only check sequence equality.
    //
    MatchName Option = "MatchName"
)

Options available for use in Seqrch functions.

const SkipAlternateWells Option = "SkipAlternateWells"

SkipAlternateWells is an option which can be used in the NextFreeWell function to skip each other well and once the end of the plate is reached go back to the beginning and fill the skipped wells. This is designed to facilitate multichannel when using a 384 well plate and a fixed 8 channel pipette head.

type Result Uses

type Result struct {
    Thing     string
    Positions []int
    Reverse   bool
}

Result is the positions found of a Thing in a query string. Reverse is given as an option to specify if the Result corresponds to a reverse of the original query, or reverse compliment in the case of a DNA sequence. For searching in BioSequences the sequences.SearchResult type is preferred. The sequences.FindAll and sequences.Replace functions are the recommended mechanisms to use with the sequences.SearchResult type. Positions are recorded in Human friendly form, i.e. the position of A in ABC is 1 and not 0.

func FindAllStrings Uses

func FindAllStrings(template string, targets []string, options ...Option) (thingsfound []Result)

FindAllStrings searches for all instances of a slice of target strings in a template string. Not perfect yet! issue with byte conversion of certain characters! This returns positions in "HumanFriendly" format (i.e. the first position of the sequence will be 1 not 0) If the IgnoreCase option is specified the strings will be compared ignoring case.

func (Result) CodeFriendlyPositions Uses

func (r Result) CodeFriendlyPositions() []int

CodeFriendlyPositions returns all positions in code friendly format where the first position is 0. i.e. the position of A in ABC is 0 and not 1.

func (Result) HumanFriendlyPositions Uses

func (r Result) HumanFriendlyPositions() []int

HumanFriendlyPositions returns all positions in human friendly format where the first position is 1. i.e. the position of A in ABC is 1 and not 0.

func (Result) ToString Uses

func (r Result) ToString() (descriptions string)

ToString returns a string description of the Result.

Package search imports 6 packages (graph) and is imported by 11 packages. Updated 2018-11-27. Refresh now. Tools for package owners.