gts

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 14 Imported by: 0

README

GTS: The Genomic Tool Suite

A software suite for genome flatfile manipulation.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QuotedQualifierNames = []string{
		"allele", "altitude", "artificial_location", "bio_material",
		"bound_moiety", "cell_line", "cell_type", "chromosome",
		"clone", "clone_lib", "collected_by", "collection_date",
		"country", "cultivar", "culture_collection", "db_xref",
		"dev_stage", "EC_number", "ecotype", "exception",
		"experiment", "frequency", "function", "gap_type", "gene",
		"gene_synonym", "haplogroup", "haplotype", "host",
		"identified_by", "inference", "isolate", "isolation_source",
		"lab_host", "lat_lon", "linkage_evidence", "locus_tag", "map",
		"mating_type", "metagenome_source", "mobile_element_type",
		"mol_type", "ncRNA_class", "note", "old_locus_tag", "operon",
		"organelle", "organism", "PCR_conditions", "PCR_primers",
		"phenotype", "plasmid", "pop_variant", "product",
		"protein_id", "pseudogene", "recombination_class",
		"regulatory_class", "replace", "rpt_family", "rpt_unit_seq",
		"satellite", "segment", "serotype", "serovar", "sex",
		"specimen_voucher", "standard_name", "strain", "sub_clone",
		"submitter_seqid", "sub_species", "sub_strain", "tissue_lib",
		"tissue_type", "translation", "type_material", "variety",
	}

	LiteralQualifierNames = []string{
		"anticodon", "citation", "codon_start", "compare",
		"direction", "estimated_length", "mod_base", "number",
		"rpt_type", "rpt_unit_range", "tag_peptide", "transl_except",
		"transl_table",
	}

	ToggleQualifierNames = []string{
		"environmental_sample", "focus", "germline", "macronuclear",
		"partial", "proviral", "pseudo", "rearranged",
		"ribosomal_slippage", "transgenic", "trans_splicing",
	}
)

Names of qualifiers.

View Source
var AmbiguousLocationParser = pars.Seq(
	pars.Int, '.', pars.Int,
).Map(func(result *pars.Result) error {
	loc := NewAmbiguousLocation(
		result.Children[0].Value.(int)-1,
		result.Children[2].Value.(int),
	)
	result.SetValue(loc)
	return nil
})

AmbiguousLocationParser attempts to parse a AmbiguousLocation.

View Source
var BetweenLocationParser = pars.Seq(
	pars.Int, '^', pars.Int,
).Map(func(result *pars.Result) error {
	loc := NewBetweenLocation(
		result.Children[0].Value.(int)-1,
		result.Children[2].Value.(int),
	)
	result.SetValue(loc)
	return nil
})

BetweenLocationParser attempts to parse a BetweenLocation.

View Source
var ComplementLocationParser = pars.Seq(
	"complement(", &LocationParser, ')',
).Map(pars.Child(1)).Map(func(result *pars.Result) error {
	loc := NewComplementLocation(result.Value.(Location))
	result.SetValue(loc)
	return nil
})

ComplementLocationParser attempts to parse a ComplementLocation.

View Source
var FeatureTableParser = pars.Any(
	RecordParser.Map(func(result *pars.Result) error {
		rec := result.Value.(Record)
		ft := rec.Select()
		result.SetValue(ft)
		return nil
	}),
	featureDecoderParser(yamlDecoder),
	featureDecoderParser(jsonDecoder),
)

FeatureTableParser attempts to parse a table of features.

View Source
var JoinLocationParser = pars.Seq(
	"join(", pars.Delim(&LocationParser, locationDelimiter), ')',
).Map(func(result *pars.Result) error {
	children := result.Children[1].Children
	locs := make([]Location, len(children))
	for i, child := range children {
		locs[i] = child.Value.(Location)
	}
	loc := NewJoinLocation(locs)
	result.SetValue(loc)
	return nil
})

JoinLocationParser attempts to parse a JoinLocation.

View Source
var LocationParser pars.Parser
View Source
var OrderLocationParser = pars.Seq(
	"order(", pars.Delim(&LocationParser, locationDelimiter), ')',
).Map(func(result *pars.Result) error {
	children := result.Children[1].Children
	locs := make([]Location, len(children))
	for i, child := range children {
		locs[i] = child.Value.(Location)
	}
	loc := NewOrderLocation(locs)
	result.SetValue(loc)
	return nil
})

OrderLocationParser attempts to parse a OrderLocation.

View Source
var PointLocationParser = pars.Parser(pars.Int).Map(func(result *pars.Result) error {
	n := result.Value.(int)
	loc := NewPointLocation(n - 1)
	result.SetValue(loc)
	return nil
})

PointLocationParser attempts to parse a PointLocation.

View Source
var RangeLocationParser = pars.Seq(
	pars.Maybe('<'), pars.Int, "..", pars.Maybe('>'), pars.Int,
	pars.Maybe('>'),
).Map(func(result *pars.Result) error {
	loc := NewPartialRangeLocation(
		result.Children[1].Value.(int)-1,
		result.Children[4].Value.(int),
		result.Children[0].Value != nil,
		result.Children[3].Value != nil || result.Children[5].Value != nil,
	)
	result.SetValue(loc)
	return nil
})

RangeLocationParser attempts to parse a RangeLocation.

View Source
var RecordParser = pars.Any(GenBankParser)

RecordParser attempts to parse a single sequence record.

Functions

func AddPrefix

func AddPrefix(s, prefix string) string

AddPrefix adds the given prefix after each newline.

func Any

func Any(f Feature) bool

Any returns true for any feature matched.

func Composition

func Composition(seq Sequence) map[byte]int

Composition computes the occurence of each byte within the Sequence.

func Equal

func Equal(a, b Sequence) bool

Equal tests if the given Sequences have the smae byte slice representations.

func FeatureListParser

func FeatureListParser(prefix string) pars.Parser

FeatureListParser attempts to match an INSDC feature table.

func FlatFileSplit

func FlatFileSplit(s string) []string

FlatFileSplit splits the string with the flatfile convention.

func GenBankParser

func GenBankParser(state *pars.State, result *pars.Result) error

GenBankParser attempts to parse a single GenBank record.

func IsLiteralQualifier

func IsLiteralQualifier(name string) bool

IsLiteralQualifier tests if the given qualifier name is a literal qualifier.

func IsQuotedQualifier

func IsQuotedQualifier(name string) bool

IsQuotedQualifier tests if the given qualifier name is a quoted qualifier.

func IsToggleQualifier

func IsToggleQualifier(name string) bool

IsToggleQualifier tests if the given qualifier name is a toggle qualifier.

func LocationLess

func LocationLess(a, b Location) bool

LocationLess tests if the one location is smaller than the other.

func QualifierParser

func QualifierParser(prefix string) pars.Parser

QualfierParser attempts to match a single qualifier name-value pair.

func RegisterLiteralQualifier

func RegisterLiteralQualifier(names ...string)

RegisterLiteralQualifier registers the given qualifier names as being a literal qualifier (i.e. /name=value).

func RegisterQuotedQualifier

func RegisterQuotedQualifier(names ...string)

RegisterQuotedQualifier registers the given qualifier names as being a quoted qualifer (i.e. /name="value").

func RegisterToggleQualifier

func RegisterToggleQualifier(names ...string)

RegisterToggleQualifier registers the given qualifier names as being a toggle qualifier (i.e. /name).

func Skew

func Skew(seq Sequence, nSet, pSet string) float64

Skew calculates the skewness of the Sequence. Where `n` is the number of bytes in the given Sequence also appearing in the `nSet` string and `p` is the number of bytes in the given Sequence also appearing in the `pSet` string, the skewness of the Sequence is calculated as: (p - n) / (p + n).

Types

type AmbiguousLocation

type AmbiguousLocation struct {
	Start int
	End   int
}

AmbiguousLocation represents an ambiguous location.

func (AmbiguousLocation) Len

func (loc AmbiguousLocation) Len() int

Len returns the length spanned by the location.

func (AmbiguousLocation) Locate

func (loc AmbiguousLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (AmbiguousLocation) Map

func (loc AmbiguousLocation) Map(index int) int

Map the given local index to a global index.

func (*AmbiguousLocation) Shift

func (loc *AmbiguousLocation) Shift(offset, amount int) (ok bool)

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (AmbiguousLocation) String

func (loc AmbiguousLocation) String() string

String satisfies the fmt.Stringer interface.

type BasicSequence

type BasicSequence []byte

BasicSequence is the most basic sequence type available. It is merely an alternate definition of a byte slice.

func Seq

func Seq(arg interface{}) BasicSequence

Seq is a convenience utility function which will take the given argument and attempt to convert the object into a BasicSequence.

func Slice

func Slice(seq Sequence, start, end int) BasicSequence

Slice returns a slice of the Sequnece.

func (BasicSequence) Bytes

func (s BasicSequence) Bytes() []byte

Bytes satisifies the gts.Sequence interface.

func (*BasicSequence) Delete

func (s *BasicSequence) Delete(pos, cnt int) error

Delete given number of bases from the specified position.

func (*BasicSequence) Insert

func (s *BasicSequence) Insert(pos int, seq Sequence) error

Insert a sequence at the specified position.

func (*BasicSequence) Replace

func (s *BasicSequence) Replace(pos int, seq Sequence) error

Replace the bases from the specified position with the given sequence.

type BetweenLocation

type BetweenLocation struct {
	Start int
	End   int
}

BetweenLocation represents a location between two points.

func (BetweenLocation) Len

func (loc BetweenLocation) Len() int

Len returns the length spanned by the location.

func (BetweenLocation) Locate

func (loc BetweenLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (BetweenLocation) Map

func (loc BetweenLocation) Map(index int) int

Map the given local index to a global index.

func (*BetweenLocation) Shift

func (loc *BetweenLocation) Shift(offset, amount int) (ok bool)

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (BetweenLocation) String

func (loc BetweenLocation) String() string

String satisfies the fmt.Stringer interface.

type ByLocation

type ByLocation []Feature

ByLocation implements sort.Interface for []Feature by location.

func (ByLocation) Len

func (ff ByLocation) Len() int

Len is the number of elements in the feature table.

func (ByLocation) Less

func (ff ByLocation) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (ByLocation) Swap

func (ff ByLocation) Swap(i, j int)

Swap the elements with indices i and j.

type ComplementLocation

type ComplementLocation struct {
	Location Location
}

ComplementLocation represents the complement region of a location.

func (ComplementLocation) Len

func (loc ComplementLocation) Len() int

Len returns the length spanned by the location.

func (ComplementLocation) Locate

func (loc ComplementLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (ComplementLocation) Map

func (loc ComplementLocation) Map(index int) int

Map the given local index to a global index.

func (*ComplementLocation) Shift

func (loc *ComplementLocation) Shift(offset, amount int) bool

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (ComplementLocation) String

func (loc ComplementLocation) String() string

String satisfies the fmt.Stringer interface.

type Feature

type Feature struct {
	Key        string
	Location   Location
	Qualifiers Values
	// contains filtered or unexported fields
}

Feature represents a single feature within a feature table.

func NewFeature

func NewFeature(key string, loc Location, qfs Values) Feature

NewFeature creates a new feature.

func (Feature) Bytes

func (f Feature) Bytes() []byte

Bytes satisfies the gts.Sequence interface.

func (Feature) Delete

func (f Feature) Delete(pos, cnt int)

Delete given number of bases from the specified position.

func (Feature) Format

func (f Feature) Format(prefix string, depth int) FeatureFormatter

Format creates a FeatureFormatter object for the qualifier with the given prefix and depth. If the Feature object was created by parsing some input, the qualifier values will be in the same order as in the input source. The exception to this rule is the `translation` qualifier which will always be written last. Qualifiers given during runtime will be sorted in ascending alphabetical order and written after the qualifiers present in the source.

func (Feature) Insert

func (f Feature) Insert(pos int, seq Sequence)

Insert a sequence at the specified position.

func (Feature) Replace

func (f Feature) Replace(pos int, seq Sequence)

Replace the bases from the specified position with the given sequence.

func (Feature) Translation

func (f Feature) Translation() Sequence

Translation returns the translation of the feature if available. it will return nil otherwise.

type FeatureFormatter

type FeatureFormatter struct {
	Feature Feature
	Prefix  string
	Depth   int
}

FeatureFormatter formats a Feature object with the given prefix and depth.

func (FeatureFormatter) String

func (ff FeatureFormatter) String() string

String satisfies the fmt.Stringer interface.

func (FeatureFormatter) WriteTo

func (ff FeatureFormatter) WriteTo(w io.Writer) (int, error)

WriteTo satisfies the io.WriteTo interface.

type FeatureList

type FeatureList []Feature

FeatureList represents an INSDC feature table. The features are sorted by Location in ascending order.

func ReadFeatureTable

func ReadFeatureTable(r io.Reader) (FeatureList, error)

ReadFeatureTable attempts to read and parse a table of features.

func (*FeatureList) Add

func (ff *FeatureList) Add(f Feature)

Add the feature to the feature table. The feature will be inserted in the sorted position with the exception of sources.

func (FeatureList) Format

func (ff FeatureList) Format(prefix string, depth int) FeatureListFormatter

Format creates a FeatureFormatter object for the qualifier with the given prefix and depth.

func (*FeatureList) Insert

func (ff *FeatureList) Insert(i int, f Feature)

Insert the feature to the feature table at the given position. Note that inserting a feature that disrupts the sortedness of the features will inevitably lead to predictable yet unconventional behavior when the Add method is called later. Use Add instead if this is not desired.

func (FeatureList) Select

func (ff FeatureList) Select(ss ...FeatureSelector) []Feature

Select the features in the list matching the selector criteria.

type FeatureListFormatter

type FeatureListFormatter struct {
	FeatureList FeatureList
	Prefix      string
	Depth       int
}

FeatureListFormatter formats a FeatureList object with the given prefix and depth.

func (FeatureListFormatter) String

func (ff FeatureListFormatter) String() string

String satisfies the fmt.Stringer interface.

func (FeatureListFormatter) WriteTo

func (ff FeatureListFormatter) WriteTo(w io.Writer) (int64, error)

WriteTo satisfies the io.WriterTo interface.

type FeatureSelector

type FeatureSelector func(f Feature) bool

FeatureSelector represents a filter for selecting features.

func And

And returns true if all selectors return true.

func Key

func Key(key string) FeatureSelector

Key returns true if the key of a feature matches the given key.

func Not

Not returns true if the given selector returns false.

func Or

Or returns true if any of the selectors return true.

type FeatureTable

type FeatureTable interface {
	Select(ss ...FeatureSelector) []Feature
	Add(f Feature)
}

FeatureTable represents a feature table.

type Formatter

type Formatter interface {
	fmt.Stringer
	io.WriterTo
}

Formatter can be formatted to a string or write to an io.Writer.

func DefaultFormatter

func DefaultFormatter(rec Record) Formatter

DefaultFormatter returns the default formatter for the given record.

type GenBank

type GenBank struct {
	Fields   GenBankFields
	Features FeatureList
	Origin   SequenceServer
}

GenBank represents a GenBank sequence record.

func (GenBank) Add

func (gb GenBank) Add(f Feature)

Add a feature to the GenBank record.

func (GenBank) Bytes

func (gb GenBank) Bytes() []byte

Bytes satisfies the gts.Sequence interface.

func (GenBank) Delete

func (gb GenBank) Delete(pos, cnt int) error

Delete given number of bases from the specified position.

func (GenBank) Insert

func (gb GenBank) Insert(pos int, seq Sequence) error

Insert a sequence at the specified position.

func (GenBank) Metadata

func (gb GenBank) Metadata() interface{}

Metadata returns the metadata of the GenBank record.

func (GenBank) Replace

func (gb GenBank) Replace(pos int, seq Sequence) error

Replace the bases from the specified position with the given sequence.

func (GenBank) Select

func (gb GenBank) Select(ss ...FeatureSelector) []Feature

Select the features in the list matching the selector criteria.

type GenBankFields

type GenBankFields struct {
	LocusName string
	Molecule  string
	Topology  string
	Division  string
	Date      time.Time

	Definition string
	Accession  string
	Version    string
	DBLink     PairList
	Keywords   []string
	Source     Organism
	References []Reference
	Comment    string
}

GenBankFields represents the fields of a GenBank record other than the features and sequence.

type GenBankFormatter

type GenBankFormatter struct {
	Rec Record
}

GenBankFormatter attempts to format a record in GenBank flatfile format.

func (GenBankFormatter) String

func (gf GenBankFormatter) String() string

func (GenBankFormatter) WriteTo

func (gf GenBankFormatter) WriteTo(w io.Writer) (int64, error)

type JoinLocation

type JoinLocation struct {
	Locations []Location
}

JoinLocation represents multiple joined locations.

func (JoinLocation) Len

func (loc JoinLocation) Len() int

Len returns the length spanned by the location.

func (JoinLocation) Locate

func (loc JoinLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (JoinLocation) Map

func (loc JoinLocation) Map(index int) int

Map the given local index to a global index.

func (*JoinLocation) Shift

func (loc *JoinLocation) Shift(pos, n int) bool

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (JoinLocation) String

func (loc JoinLocation) String() string

String satisfies the fmt.Stringer interface.

type Location

type Location interface {
	// Locate the sequence at the pointing location.
	Locate(seq Sequence) Sequence

	// Len returns the length spanned by the location.
	Len() int

	// String satisfies the fmt.Stringer interface.
	String() string

	// Shift the location by the given amount if needed.
	// Returns false if the shift invalidates the location.
	Shift(offset, amount int) bool

	// Map the given local index to a global index.
	Map(index int) int
}

Location represents a feature location as defined by the INSDC.

func AsLocation

func AsLocation(s string) (Location, error)

AsLocation attempts to interpret the given string as a Location.

func NewAmbiguousLocation

func NewAmbiguousLocation(start, end int) Location

NewAmbiguousLocation creates a new ambiguous location.

func NewBetweenLocation

func NewBetweenLocation(start, end int) Location

NewBetweenLocation creates a new BetweenLocation.

func NewComplementLocation

func NewComplementLocation(loc Location) Location

NewComplementLocation creates a new ComplementLocation.

func NewJoinLocation

func NewJoinLocation(locs []Location) Location

NewJoinLocation creates a new JoinLocation.

func NewOrderLocation

func NewOrderLocation(locs []Location) Location

NewOrderLocation creates a new OrderLocation.

func NewPartialRangeLocation

func NewPartialRangeLocation(start, end int, p5, p3 bool) Location

NewPartialRangeLocation creates a new partial RangeLocation.

func NewPointLocation

func NewPointLocation(pos int) Location

NewPointLocation creates a new PointLocation.

func NewRangeLocation

func NewRangeLocation(start, end int) Location

NewRangeLocation creates a new RangeLocation.

type Mutable

type Mutable interface {
	Sequence
	Insert(pos int, seq Sequence)
	Delete(pos, cnt int)
	Replace(pos int, seq Sequence)
}

Mutable is a sequence which can be manipulated in-place.

type MutableSequence

type MutableSequence interface {
	Insert(pos int, seq Sequence) error
	Delete(pos, cnt int) error
	Replace(pos int, seq Sequence) error
	Sequence
}

MutableSequence is a sequence which can be manipulated in-place.

type OrderLocation

type OrderLocation struct {
	Locations []Location
}

OrderLocation represents a group of locations.

func (OrderLocation) Len

func (loc OrderLocation) Len() int

Len returns the length spanned by the location.

func (OrderLocation) Locate

func (loc OrderLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (OrderLocation) Map

func (loc OrderLocation) Map(index int) int

Map the given local index to a global index.

func (*OrderLocation) Shift

func (loc *OrderLocation) Shift(pos, n int) bool

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (OrderLocation) String

func (loc OrderLocation) String() string

String satisfies the fmt.Stringer interface.

type Organism

type Organism struct {
	Species string
	Name    string
	Taxon   []string
}

Organism represents an organism of a record.

type Pair

type Pair struct {
	Key   string
	Value string
}

Pair represents a pair of strings.

type PairList

type PairList []Pair

PairList represents a list of pairs.

func (*PairList) Set

func (pl *PairList) Set(key, value string)

Set the value for the given key.

type PointLocation

type PointLocation struct{ Position int }

PointLocation represents a single point.

func (PointLocation) Len

func (loc PointLocation) Len() int

Len returns the length spanned by the location.

func (PointLocation) Locate

func (loc PointLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (PointLocation) Map

func (loc PointLocation) Map(index int) int

Map the given local index to a global index.

func (*PointLocation) Shift

func (loc *PointLocation) Shift(offset, amount int) bool

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (PointLocation) String

func (loc PointLocation) String() string

String satisfies the fmt.Stringer interface.

type Qualifier

type Qualifier struct {
	Name  string
	Value string
}

Qualifier represents a single qualifier name-value pair.

func (Qualifier) Format

func (q Qualifier) Format(prefix string) QualifierFormatter

Format creates a QualifierFormatter object for the qualifier with the given prefix.

func (Qualifier) String

func (q Qualifier) String() string

String satisfies the fmt.Stringer interface.

type QualifierFormatter

type QualifierFormatter struct {
	Qualifier Qualifier
	Prefix    string
}

QualifierFormatter formats a Qualifier object with the given prefix.

func (QualifierFormatter) String

func (qf QualifierFormatter) String() string

String satisfies the fmt.Stringer interface.

func (QualifierFormatter) WriteTo

func (qf QualifierFormatter) WriteTo(w io.Writer) (int, error)

WriteTo satisfies the io.WriterTo interface.

type QualifierType

type QualifierType int

QualifierType represents the type of qualifier.

const (
	QuotedQualifier QualifierType = iota
	LiteralQualifier
	ToggleQualifier
	UnknownQualifier
)

Available qualifier types.

func GetQualifierType

func GetQualifierType(name string) QualifierType

GetQualifierType returns the qualifier type of the given qualifier name.

type Range

type Range struct {
	Start int
	End   int
}

Range represents a start and end index pair.

type RangeLocation

type RangeLocation struct {
	Start    int
	End      int
	Partial5 bool
	Partial3 bool
}

RangeLocation represents a range of locations.

func (RangeLocation) Len

func (loc RangeLocation) Len() int

Len returns the length spanned by the location.

func (RangeLocation) Locate

func (loc RangeLocation) Locate(seq Sequence) Sequence

Locate the sequence at the pointing location.

func (RangeLocation) Map

func (loc RangeLocation) Map(index int) int

Map the given local index to a global index.

func (*RangeLocation) Shift

func (loc *RangeLocation) Shift(offset, amount int) (ok bool)

Shift the location position[s] if needed. Returns false if the shift invalidates the location.

func (RangeLocation) String

func (loc RangeLocation) String() string

String satisfies the fmt.Stringer interface.

type Record

type Record interface {
	Metadata() interface{}
	FeatureTable
	MutableSequence
}

Record is the interface for sequence records with metadata and features.

func NewRecord

func NewRecord(meta interface{}, ff []Feature, p []byte) Record

NewRecord creates a new record/

type RecordScanner

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

RecordScanner scans one sequence record at a time.

func NewRecordScanner

func NewRecordScanner(r io.Reader) *RecordScanner

NewRecordScanner creates a new RecordScanner.

func (RecordScanner) Err

func (s RecordScanner) Err() error

Err returns the first non-EOF error that was encountered by the Scanner.

func (*RecordScanner) Record

func (s *RecordScanner) Record() Record

Record returns the most recent Record generated by a call to Scan.

func (*RecordScanner) Scan

func (s *RecordScanner) Scan() bool

Scan advances the Scanner to the next Record.

type Reference

type Reference struct {
	Number  int
	Ranges  []Range
	Authors string
	Group   string
	Title   string
	Journal string
	Xref    map[string]string
	Comment string
}

Reference represents a reference of a record.

type Sequence

type Sequence interface {
	Bytes() []byte
}

Sequence represents a sequence type. All Sequence types must be able to generate a byte slice representation of itself.

func Complement

func Complement(seq Sequence) Sequence

func Fragment

func Fragment(seq Sequence, window, slide int) []Sequence

Fragment returns a slice of Sequences containing all subsequences of the given Sequence from position 0 separated by `slide` bytes and with length of `window`.

type SequenceProxy

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

SequenceProxy represents a mutable sequence that will send modification requests to a SequenceServer.

func (SequenceProxy) Bytes

func (sp SequenceProxy) Bytes() []byte

Bytes satisfies the gts.Sequence interface.

func (SequenceProxy) Delete

func (sp SequenceProxy) Delete(pos, cnt int) error

Delete given number of bases from the specified position.

func (SequenceProxy) Insert

func (sp SequenceProxy) Insert(pos int, seq Sequence) error

Insert a sequence at the specified position.

func (SequenceProxy) Replace

func (sp SequenceProxy) Replace(pos int, seq Sequence) error

Replace the bases from the specified position with the given sequence.

type SequenceServer

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

SequenceServer is a mutable sequence that can be modified by proxies.

func NewSequenceServer

func NewSequenceServer(seq Sequence) SequenceServer

NewSequenceServer creates a new SequenceServer.

func (SequenceServer) Bytes

func (ss SequenceServer) Bytes() []byte

Bytes satisfies the gts.Sequence interface.

func (*SequenceServer) Close

func (ss *SequenceServer) Close()

Close deactivates the SequenceServer.

func (*SequenceServer) Delete

func (ss *SequenceServer) Delete(pos, cnt int) error

Delete given number of bases from the specified position.

func (*SequenceServer) Insert

func (ss *SequenceServer) Insert(pos int, seq Sequence) error

Insert a sequence at the specified position.

func (SequenceServer) Proxy

func (ss SequenceServer) Proxy() SequenceProxy

Proxy creates a proxy to the SequenceServer.

func (*SequenceServer) Replace

func (ss *SequenceServer) Replace(pos int, seq Sequence) error

Replace the bases from the specified position with the given sequence.

func (*SequenceServer) Spin

func (ss *SequenceServer) Spin()

Spin prepares internal channels for recieving messages from the proxies associated to this SequenceServer.

type Values

type Values map[string][]string

Values represents a collection of name-value list pairs.

func (Values) Add

func (v Values) Add(name, value string)

Add appends a value to the values associated to the given name.

func (Values) Del

func (v Values) Del(name string)

Del deletes the values associated to the given name.

func (Values) Get

func (v Values) Get(key string) []string

Get returns the values associated to the given name.

func (Values) Set

func (v Values) Set(name string, values ...string)

Set overwrites the values associated to the given name.

Directories

Path Synopsis
cmd
gts command

Jump to

Keyboard shortcuts

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