Documentation ¶
Index ¶
- Variables
- func Abs(x int) int
- func Compare(i, j int) int
- func Equal(a, b Sequence) bool
- func FalseFilter(f Feature) bool
- func ForwardStrand(f Feature) bool
- func Len(seq Sequence) int
- func LocationLess(a, b Location) bool
- func LocationOverlap(loc Location, lower, upper int) bool
- func LocationWithin(loc Location, lower, upper int) bool
- func Max(i, j int) int
- func Min(i, j int) int
- func ReverseStrand(f Feature) bool
- func TrueFilter(f Feature) bool
- func Unpack(p [2]int) (int, int)
- type Ambiguous
- func (ambiguous Ambiguous) Complement() Location
- func (ambiguous Ambiguous) Expand(i, n int) Location
- func (ambiguous Ambiguous) Len() int
- func (ambiguous Ambiguous) Normalize(length int) Location
- func (ambiguous Ambiguous) Region() Region
- func (ambiguous Ambiguous) Reverse(length int) Location
- func (ambiguous Ambiguous) Shift(i, n int) Location
- func (ambiguous Ambiguous) String() string
- type BasicSequence
- type Between
- func (between Between) Complement() Location
- func (between Between) Expand(i, n int) Location
- func (between Between) Len() int
- func (between Between) Normalize(length int) Location
- func (between Between) Region() Region
- func (between Between) Reverse(length int) Location
- func (between Between) Shift(i, n int) Location
- func (between Between) String() string
- type BySegment
- type Complemented
- func (complement Complemented) Complement() Location
- func (complement Complemented) Expand(i, n int) Location
- func (complement Complemented) Len() int
- func (complement Complemented) Normalize(length int) Location
- func (complement Complemented) Region() Region
- func (complement Complemented) Reverse(length int) Location
- func (complement Complemented) Shift(i, n int) Location
- func (complement Complemented) String() string
- type Expandable
- type Feature
- type FeatureSlice
- type Filter
- type Head
- type HeadHead
- type HeadTail
- type Item
- type Joined
- func (joined Joined) Complement() Location
- func (joined Joined) Expand(i, n int) Location
- func (joined Joined) Len() int
- func (joined Joined) Normalize(length int) Location
- func (joined Joined) Region() Region
- func (joined Joined) Reverse(length int) Location
- func (joined Joined) Shift(i, n int) Location
- func (joined Joined) String() string
- type Location
- type LocationList
- type Locations
- type Locator
- type Modifier
- type Molecule
- type Ordered
- func (ordered Ordered) Complement() Location
- func (ordered Ordered) Expand(i, n int) Location
- func (ordered Ordered) Len() int
- func (ordered Ordered) Normalize(length int) Location
- func (ordered Ordered) Region() Region
- func (ordered Ordered) Reverse(length int) Location
- func (ordered Ordered) Shift(i, n int) Location
- func (ordered Ordered) String() string
- type Partial
- type Point
- func (point Point) Complement() Location
- func (point Point) Expand(i, n int) Location
- func (point Point) Len() int
- func (point Point) Normalize(length int) Location
- func (point Point) Region() Region
- func (point Point) Reverse(length int) Location
- func (point Point) Shift(i, n int) Location
- func (point Point) String() string
- type Props
- func (props *Props) Add(key string, values ...string)
- func (props Props) Clone() Props
- func (props *Props) Del(key string)
- func (props Props) Get(key string) []string
- func (props Props) Has(name string) bool
- func (props Props) Index(key string) int
- func (props Props) Items() []Item
- func (props Props) Keys() []string
- func (props *Props) Set(key string, values ...string)
- type Ranged
- func (ranged Ranged) Complement() Location
- func (ranged Ranged) Expand(i, n int) Location
- func (ranged Ranged) Len() int
- func (ranged Ranged) Normalize(length int) Location
- func (ranged Ranged) Region() Region
- func (ranged Ranged) Reverse(length int) Location
- func (ranged Ranged) Shift(i, n int) Location
- func (ranged Ranged) String() string
- type Region
- type Regions
- type Segment
- type Sequence
- func Complement(seq Sequence) Sequence
- func Concat(ss ...Sequence) Sequence
- func Delete(seq Sequence, offset, length int) Sequence
- func Embed(host Sequence, index int, guest Sequence) Sequence
- func Erase(seq Sequence, offset, length int) Sequence
- func Insert(host Sequence, index int, guest Sequence) Sequence
- func Reverse(seq Sequence) Sequence
- func Rotate(seq Sequence, n int) Sequence
- func Slice(seq Sequence, start, end int) Sequence
- func Transcribe(seq Sequence) Sequence
- func WithBytes(seq Sequence, p []byte) Sequence
- func WithFeatures(seq Sequence, ff []Feature) Sequence
- func WithInfo(seq Sequence, info interface{}) Sequence
- func WithTopology(seq Sequence, t Topology) Sequence
- type Shiftable
- type Sliceable
- type Strand
- type Tail
- type TailTail
- type Topology
Constants ¶
This section is empty.
Variables ¶
var ( Complete = Partial{false, false} Partial5 = Partial{true, false} Partial3 = Partial{false, true} PartialBoth = Partial{true, true} )
Partiality values.
var ParseLocation pars.Parser
ParseLocation parses a single location.
var Version = flags.Version{
Major: 0,
Minor: 28,
Patch: 1,
}
Version represents the GTS software version.
Functions ¶
func Equal ¶
Equal tests if the given sequences are identical by comparing the deep equality of the metadata, features, and byte representations.
func FalseFilter ¶ added in v0.9.0
FalseFilter always return false.
func ForwardStrand ¶ added in v0.27.1
ForwardStrand returns true if the feature strictly resides on the forward strand.
func Len ¶ added in v0.2.0
Len returns the length of the given Sequence by computing the length of the byte representation. If the sequece implements the `Len() int` method, the method will be called instead.
func LocationLess ¶
LocationLess tests if location a is less than b.
func LocationOverlap ¶ added in v0.25.0
LocationOverlap tests if the given location overlaps with the given bounds.
func LocationWithin ¶ added in v0.25.0
LocationWithin tests if the given location is within the given bounds.
func ReverseStrand ¶ added in v0.27.1
ReverseStrand returns true if the feature strictly resides on the reverse strand.
Types ¶
type Ambiguous ¶ added in v0.9.0
Ambiguous represents a single base within a given range.
func (Ambiguous) Complement ¶ added in v0.11.6
Complement returns the complement location.
func (Ambiguous) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Ambiguous) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type BasicSequence ¶
type BasicSequence struct {
// contains filtered or unexported fields
}
BasicSequence represents the most basic Sequence object.
func Copy ¶ added in v0.9.0
func Copy(seq Sequence) BasicSequence
Copy returns a shallow copy of the given sequence.
func New ¶ added in v0.6.0
func New(info interface{}, table FeatureSlice, p []byte) BasicSequence
New returns a new Sequence object with the given values.
func (BasicSequence) Bytes ¶
func (seq BasicSequence) Bytes() []byte
Bytes returns the byte representation of the sequence.
func (BasicSequence) Features ¶ added in v0.9.0
func (seq BasicSequence) Features() FeatureSlice
Features returns the feature table of the sequence.
func (BasicSequence) Info ¶ added in v0.9.0
func (seq BasicSequence) Info() interface{}
Info returns the metadata of the sequence.
type Between ¶ added in v0.9.0
type Between int
Between represents a position between two bases. This will only make logical sense if the start and end positions are directly adjacent.
func (Between) Complement ¶ added in v0.9.0
Complement returns the complement location.
func (Between) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Between) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type BySegment ¶ added in v0.19.0
type BySegment []Segment
BySegment attaches the methods of sort.Interface to []Segment, sorting in increasing order.
type Complemented ¶ added in v0.9.0
type Complemented struct {
Location Location
}
Complemented represents a location complemented for the given molecule type.
func (Complemented) Complement ¶ added in v0.9.0
func (complement Complemented) Complement() Location
Complement returns the complement location.
func (Complemented) Expand ¶ added in v0.9.1
func (complement Complemented) Expand(i, n int) Location
Expand the location beyond the given position i by n.
func (Complemented) Len ¶ added in v0.9.0
func (complement Complemented) Len() int
Len returns the total length spanned by the location.
func (Complemented) Normalize ¶ added in v0.9.0
func (complement Complemented) Normalize(length int) Location
Normalize returns a location normalized for the given length sequence.
func (Complemented) Region ¶ added in v0.18.0
func (complement Complemented) Region() Region
Region returns the region pointed to by the location.
func (Complemented) Reverse ¶ added in v0.9.0
func (complement Complemented) Reverse(length int) Location
Reverse returns the reversed location for the given length sequence.
func (Complemented) Shift ¶ added in v0.9.0
func (complement Complemented) Shift(i, n int) Location
Shift the location beyond the given position i by n.
func (Complemented) String ¶ added in v0.9.0
func (complement Complemented) String() string
String satisfies the fmt.Stringer interface.
type Expandable ¶ added in v0.23.0
type Expandable interface {
Expand(i, n int) interface{}
}
Expandable represents a expandable metadata.
type FeatureSlice ¶ added in v0.27.1
type FeatureSlice []Feature
FeatureSlice represents a slice of Features.
func (FeatureSlice) Filter ¶ added in v0.27.1
func (ff FeatureSlice) Filter(filter Filter) FeatureSlice
Filter returns a FeatureSlice containing the features that match the given Filter within this FeatureSlice.
func (FeatureSlice) Insert ¶ added in v0.27.1
func (ff FeatureSlice) Insert(f Feature) FeatureSlice
Insert takes the given Feature and inserts it into the sorted position in the FeatureSlice.
func (FeatureSlice) Len ¶ added in v0.27.1
func (ff FeatureSlice) Len() int
Len is the number of elements in the collection.
func (FeatureSlice) Less ¶ added in v0.27.1
func (ff FeatureSlice) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (FeatureSlice) Swap ¶ added in v0.27.1
func (ff FeatureSlice) Swap(i, j int)
Swap the elements with indexes i and j.
type Filter ¶ added in v0.8.0
Filter represents a filtering function for a Feature. It should return a boolean value upon receiveing a Feature object.
func And ¶
And generates a new Filter which will only return true if all of the given filters return true for a given Feature object.
func Key ¶
Key returns true if the key of a feature matches the given key string. If an empty string was given, the filter will always return true.
func Not ¶
Not generates a new Filter which will return true if the given Filter returns false for a given Feature object.
func Or ¶
Or generates a new Filter which will return true if any one of the given filters return true for a given Feature object.
func Overlap ¶ added in v0.23.0
Overlap returns true if the location of the feature overlaps with the given bounds.
func Qualifier ¶
Qualifier tests if any of the values associated with the given qualifier name matches the given regular expression query. If the qualifier name is empty, the values for every qualifier name will be tested.
func Selector ¶ added in v0.9.0
Selector generates a new Filter which will return true if a given Feature satisfies the criteria specified by the selection string. A selector in GTS is defined as follows:
[feature_key]/qualifier_name=regexp[/qualifier_name=regexp]...
If the qualifier name is omitted, the values for every qualifier name will be tested.
type Head ¶ added in v0.18.0
type Head int
Head collapses a region onto its head, offset by the value given.
type HeadHead ¶ added in v0.18.0
type HeadHead [2]int
HeadHead offsets the head coordinate by the values given.
type HeadTail ¶ added in v0.18.0
type HeadTail [2]int
HeadTail offsets the head and tail coordinates by the values given.
type Joined ¶ added in v0.9.0
type Joined []Location
Joined represents a list of Location locations. It is strongly recommended this be constructed using the Join helper function to reduce the list of Location locations to the simplest representation.
func (Joined) Complement ¶ added in v0.9.0
Complement returns the complement location.
func (Joined) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Joined) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type Location ¶
type Location interface { fmt.Stringer Len() int Region() Region Complement() Location Reverse(length int) Location Normalize(length int) Location Shift(i, n int) Location Expand(i, n int) Location }
Location represents a location in a sequence as defined by the INSDC feature table definition.
func AsLocation ¶
AsLocation interprets the given string as a Location.
func Join ¶ added in v0.9.0
Join the given Location locations. Will panic if no argument is given. The locations will first be reduced to the simplest representation by merging adjacent identical locations and contiguous locations. If the resulting list of locations have only one element, the elemnt will be returuned. Otherwise, a Joined object will be returned.
type LocationList ¶ added in v0.11.6
type LocationList struct { Data Location Next *LocationList }
LocationList represents a singly linked list of Location objects.
func (*LocationList) Len ¶ added in v0.11.6
func (ll *LocationList) Len() int
Len returns the length of the list.
func (*LocationList) Push ¶ added in v0.11.6
func (ll *LocationList) Push(loc Location, force bool)
Push a Location object to the end of the list. If the Location object is equivalent to the last element, nothing happens. If the Location object can be joined with the last element to form a contiguous Location location, the last element will be replaced with the joined Location object. If the force option is false, then only partial ranges will be joined.
func (*LocationList) Slice ¶ added in v0.11.6
func (ll *LocationList) Slice() []Location
Slice returns the slice representation of the list.
type Locations ¶ added in v0.23.1
type Locations []Location
Locations represents a sortable list of locations.
type Modifier ¶ added in v0.18.0
Modifier is an interface required to modify coordinate regions.
func AsModifier ¶ added in v0.18.0
AsModifier interprets the given string as a Modifier.
type Molecule ¶ added in v0.9.0
type Molecule string
Molecule represents the sequence molecule type.
const ( DNA Molecule = "DNA" RNA Molecule = "RNA" AA Molecule = "AA" SingleStrandDNA Molecule = "ss-DNA" DoubleStrandDNA Molecule = "ds-DNA" )
Molecule constants for DNA, RNA, and amino acid (AA).
func AsMolecule ¶ added in v0.13.0
AsMolecule attempts to convert a string into a Molecule object.
type Ordered ¶ added in v0.9.0
type Ordered []Location
Ordered represents multiple locations.
func (Ordered) Complement ¶ added in v0.11.6
Complement returns the complement location.
func (Ordered) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Ordered) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type Point ¶ added in v0.9.0
type Point int
Point represents a single base position in a sequence.
func (Point) Complement ¶ added in v0.9.0
Complement returns the complement location.
func (Point) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Point) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type Ranged ¶ added in v0.9.0
Ranged represents a contiguous region of bases in a sequence. The starting and ending positions of a Ranged may be partial.
func PartialRange ¶ added in v0.9.0
PartialRange returns the range between the start and end positions where the specified ends are partial. They can be Complete, Partial5, Partial3, or PartialBoth.
func (Ranged) Complement ¶ added in v0.9.0
Complement returns the complement location.
func (Ranged) Normalize ¶ added in v0.9.0
Normalize returns a location normalized for the given length sequence.
func (Ranged) Reverse ¶ added in v0.9.0
Reverse returns the reversed location for the given length sequence.
type Region ¶ added in v0.18.0
type Region interface { Len() int Head() int Tail() int Resize(mod Modifier) Region Complement() Region Locate(seq Sequence) Sequence }
Region represents a coordinate region which can be resized and used to locate the subsequence within a given sequence corresponding to the region that is being represented.
func InvertCircular ¶ added in v0.27.1
func InvertLinear ¶ added in v0.27.1
type Regions ¶ added in v0.18.0
type Regions []Region
Regions is a slice or Region objects.
func (Regions) Complement ¶ added in v0.18.0
Complement returns the equivalent Region on the complement strand.
func (Regions) Locate ¶ added in v0.18.0
Locate the subsequence corresponding to the region in the given sequence.
type Segment ¶ added in v0.19.0
type Segment [2]int
Segment represents a contiguous region.
func Match ¶ added in v0.22.0
Match for an oligomer within a sequence. The ambiguous nucleotides in the query sequence will match any of the respective nucleotides.
func Minimize ¶ added in v0.19.0
Minimize the representation of the given region. A minimized region will be flattened, sorted, and overlapping areas removed.
func (Segment) Complement ¶ added in v0.19.0
Complement returns the equivalent region for the complement strand.
func (Segment) Locate ¶ added in v0.19.0
Locate the subsequence corresponding to the region in the given sequence.
type Sequence ¶
type Sequence interface { Info() interface{} Features() FeatureSlice Bytes() []byte }
Sequence represents a biological sequence. All sequences are expected to be able to return its metadata, associated features, and byte representation.
func Complement ¶
Complement returns the complement DNA sequence based on the FASTA sequence representation. All 'A's will be complemented to a 'T'. If the resulting sequence is intended to be RNA, use Transcribe instead.
func Concat ¶ added in v0.9.0
Concat takes the given Sequences and concatenates them into a single Sequence.
func Delete ¶ added in v0.9.0
Delete a region of the sequence at the given offset and length. Any features with a location containing the point of deletion will be shortened by the length of deletion. If the entirety of the feature is shortened as a result, the location will be described as a offset in between the bases where the deletion occurred.
func Embed ¶ added in v0.9.0
Embed a sequence at the given index. For any feature whose location covers a region containing the point of insertion, the location will be extended by the length of the guest Sequence.
func Erase ¶ added in v0.21.0
Erase a region of the sequence at the given offset and length. Any features with a location containing the point of deletion will be shortened by the length of deletion. If the entirety of the feature is shortened as a result, the location will be removed from the sequence.
func Insert ¶ added in v0.9.0
Insert a sequence at the given index. For any feature whose location covers a region containing the point of insertion, the location will be split at the positions before and after the guest sequence.
func Reverse ¶ added in v0.9.0
Reverse returns a Sequence object with the byte representation in the reversed order. The feature locations will be reversed accordingly.
func Rotate ¶ added in v0.9.0
Rotate returns a Sequence object whose coordinates are shifted by the given amount. Features which surpass the representational edges of the sequences are shifted and split as necessary.
func Slice ¶
Slice returns a subsequence of the given sequence starting at start and up to end. The target sequence region is copied. Any features with locations overlapping with the sliced region will be left in the sliced sequence.
func Transcribe ¶ added in v0.9.0
Transcribe returns the complement RNA sequence based on the FASTA sequence representation. All 'A's will be transcribed to a 'U'. If the resulting sequence is intended to be DNA, use Complement instead.
func WithBytes ¶ added in v0.9.0
WithBytes creates a shallow copy of the given Sequence object and swaps the byte representation with the given byte slice. If the sequence implements the `WithBytes(p []info) Sequence` method, it will be called instead.
func WithFeatures ¶ added in v0.9.0
WithFeatures creates a shallow copy of the given Sequence object and swaps the feature table with the given features. If the sequence implements the `WithFeatures(ff FeatureSlice) Sequence` method, it will be called instead.
func WithInfo ¶ added in v0.9.0
WithInfo creates a shallow copy of the given Sequence object and swaps the metadata with the given value. If the sequence implements the `WithInfo(info interface{}) Sequence` method, it will be called instead.
func WithTopology ¶ added in v0.12.0
WithTopology creates a shallow copy of the given Sequence object and swaps the topology value with the given topology. If the sequence implements the `WithTopology(t Topoplogy) Sequence` method, it will be called instead.
type Shiftable ¶ added in v0.23.0
type Shiftable interface {
Shift(i, n int) interface{}
}
Shiftable represents a shiftable metadata.
type Sliceable ¶ added in v0.23.0
type Sliceable interface {
Slice(start, end int) interface{}
}
Sliceable represents a sliceable metadata.
type Tail ¶ added in v0.18.0
type Tail int
Tail collapses a region onto its tail, offset by the value given.
type TailTail ¶ added in v0.18.0
type TailTail [2]int
TailTail offsets the head coordinate by the values given.
type Topology ¶ added in v0.12.0
type Topology int
Topology represents the sequence topology.
func AsTopology ¶ added in v0.12.0
AsTopology converts a string to a Topology object.