Documentation
¶
Index ¶
- Variables
- func AddPrefix(s, prefix string) string
- func AmbiguousLocationParser(state *pars.State, result *pars.Result) error
- func Any(f Feature) bool
- func BetweenLocationParser(state *pars.State, result *pars.Result) error
- func ComplementLocationParser(state *pars.State, result *pars.Result) error
- func Composition(seq Sequence) map[byte]int
- func DecodeGob(data []byte, v Decodable) error
- func DecodeJSON(data []byte, v Decodable) error
- func DecoderParser(decCtor DecoderConstructor, objCtor Constructor) pars.Parser
- func DefaultWriter(seq Sequence) io.WriterTo
- func EncodeGob(v Encodable) ([]byte, error)
- func EncodeJSON(v Encodable) ([]byte, error)
- func Equal(a, b Sequence) bool
- func FeatureListParser(prefix string) pars.Parser
- func FlatFileSplit(s string) []string
- func GenBankParser(state *pars.State, result *pars.Result) error
- func Identical(a, b Sequence) bool
- func IsLiteralQualifier(name string) bool
- func IsQuotedQualifier(name string) bool
- func IsToggleQualifier(name string) bool
- func JoinLocationParser(state *pars.State, result *pars.Result) error
- func Len(seq Sequence) int
- func LocationLess(a, b Location) bool
- func NewRecordWriter(rec Record, filetype FileType) io.WriterTo
- func NewSequenceWriter(seq Sequence, filetype FileType) io.WriterTo
- func OrderLocationParser(state *pars.State, result *pars.Result) error
- func PointLocationParser(state *pars.State, result *pars.Result) error
- func QualifierParser(prefix string) pars.Parser
- func RangeLocationParser(state *pars.State, result *pars.Result) error
- func RegisterLiteralQualifier(names ...string)
- func RegisterQuotedQualifier(names ...string)
- func RegisterToggleQualifier(names ...string)
- func Skew(seq Sequence, nSet, pSet string) float64
- type AmbiguousLocation
- type BetweenLocation
- type ByLocation
- type ComplementLocation
- type Constructor
- type Date
- type Decodable
- type Decoder
- type DecoderConstructor
- type Encodable
- type Encoder
- type EncoderConstructor
- type EncoderWriter
- type Fasta
- type FastaWriter
- type Feature
- func (f Feature) Bytes() []byte
- func (f *Feature) DecodeMsgpack(dec *msgpack.Decoder) error
- func (f *Feature) DecodeWith(dec Decoder) (err error)
- func (f Feature) Delete(pos, cnt int) error
- func (f Feature) EncodeMsgpack(enc *msgpack.Encoder) error
- func (f Feature) EncodeWith(enc Encoder) error
- func (f Feature) Format(prefix string, depth int) FeatureFormatter
- func (f Feature) Info() interface{}
- func (f Feature) Insert(pos int, seq Sequence) error
- func (f Feature) MarshalJSON() ([]byte, error)
- func (f Feature) MarshalYAML() (interface{}, error)
- func (f Feature) Replace(pos int, seq Sequence) error
- func (f Feature) Translation() Sequence
- func (f *Feature) UnmarshalJSON(data []byte) error
- func (f *Feature) UnmarshalYAML(value *yaml.Node) error
- type FeatureFilter
- type FeatureFormatter
- type FeatureIO
- type FeatureList
- type FeatureListFormatter
- type FeatureTable
- type FileType
- type GTS
- type GenBank
- func (gb GenBank) Add(f Feature)
- func (gb GenBank) Bytes() []byte
- func (gb *GenBank) DecodeMsgpack(dec *msgpack.Decoder) error
- func (gb *GenBank) DecodeWith(dec Decoder) error
- func (gb GenBank) Delete(pos, cnt int) error
- func (gb GenBank) EncodeMsgpack(enc *msgpack.Encoder) error
- func (gb GenBank) EncodeWith(enc Encoder) error
- func (gb GenBank) Filter(ss ...FeatureFilter) []Feature
- func (gb *GenBank) GobDecode(data []byte) error
- func (gb GenBank) GobEncode() ([]byte, error)
- func (gb GenBank) Info() interface{}
- func (gb GenBank) Insert(pos int, seq Sequence) error
- func (gb GenBank) MarshalJSON() ([]byte, error)
- func (gb GenBank) MarshalYAML() (interface{}, error)
- func (gb GenBank) Replace(pos int, seq Sequence) error
- func (gb GenBank) String() string
- func (gb *GenBank) UnmarshalJSON(data []byte) error
- func (gb *GenBank) UnmarshalYAML(value *yaml.Node) error
- func (gb GenBank) WriteTo(w io.Writer) (int64, error)
- type GenBankFields
- type GenBankIO
- type GenBankWriter
- type JoinLocation
- type Location
- type MultiParserScanner
- type MutableSequence
- type OrderLocation
- type Organism
- type Pair
- type PairList
- type ParserScanner
- type PointLocation
- type Qualifier
- type QualifierFormatter
- type QualifierType
- type Range
- type RangeLocation
- type Record
- type RecordScanner
- type Reference
- type Scanner
- type Sequence
- type SequenceProxy
- type SequenceServer
- func (ss SequenceServer) Bytes() []byte
- func (ss *SequenceServer) Close()
- func (ss *SequenceServer) Delete(pos, arg int) error
- func (ss SequenceServer) Info() interface{}
- func (ss *SequenceServer) Insert(pos int, arg Sequence) error
- func (ss SequenceServer) Proxy() SequenceProxy
- func (ss *SequenceServer) Replace(pos int, arg Sequence) error
- func (ss *SequenceServer) Spin()
- type Values
Constants ¶
This section is empty.
Variables ¶
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.
var FeatureTableParser = pars.Any( RecordParser.Map(func(result *pars.Result) error { rec := result.Value.(Record) ft := rec.Filter() result.SetValue(ft) return nil }), featureDecoderParser(NewGobDecoder), featureDecoderParser(NewMsgpackDecoder), featureDecoderParser(NewYAMLDecoder), featureDecoderParser(NewJSONDecoder), )
FeatureTableParser attempts to parse a table of features.
var LocationParser pars.Parser
LocationParser attempts to parse some location.
var RecordParser = pars.Any(GenBankParser)
RecordParser attempts to parse a single sequence record.
Functions ¶
func AmbiguousLocationParser ¶
AmbiguousLocationParser attempts to parse a AmbiguousLocation.
func BetweenLocationParser ¶
BetweenLocationParser attempts to parse a BetweenLocation.
func ComplementLocationParser ¶
ComplementLocationParser attempts to parse a ComplementLocation.
func Composition ¶
Composition computes the occurence of each byte within the Sequence.
func DecodeJSON ¶ added in v0.3.0
DecodeJSON decodes the Decodable object from JSON.
func DecoderParser ¶ added in v0.4.0
func DecoderParser(decCtor DecoderConstructor, objCtor Constructor) pars.Parser
DecoderParser creates a Parser using the Decoder and object constructed using the Constructor.
func DefaultWriter ¶ added in v0.6.0
DefaultWriter returns the default formatter for the given record.
func EncodeJSON ¶ added in v0.3.0
EncodeJSON encodes the Encodable object as JSON.
func FeatureListParser ¶
FeatureListParser attempts to match an INSDC feature table.
func FlatFileSplit ¶
FlatFileSplit splits the string with the flatfile convention.
func GenBankParser ¶
GenBankParser attempts to parse a single GenBank record.
func Identical ¶ added in v0.6.0
Identical tests if the given Sequences have identical metadata values and byte slice representations.
func IsLiteralQualifier ¶
IsLiteralQualifier tests if the given qualifier name is a literal qualifier.
func IsQuotedQualifier ¶
IsQuotedQualifier tests if the given qualifier name is a quoted qualifier.
func IsToggleQualifier ¶
IsToggleQualifier tests if the given qualifier name is a toggle qualifier.
func JoinLocationParser ¶
JoinLocationParser attempts to parse a JoinLocation.
func LocationLess ¶
LocationLess tests if the one location is smaller than the other.
func NewRecordWriter ¶ added in v0.6.0
NewRecordWriter returns a record writer for the given filetype.
func NewSequenceWriter ¶ added in v0.6.0
NewSequenceWriter returns a sequence writer for the given filetype.
func OrderLocationParser ¶
OrderLocationParser attempts to parse a OrderLocation.
func PointLocationParser ¶
PointLocationParser attempts to parse a PointLocation.
func QualifierParser ¶
QualifierParser attempts to match a single qualifier name-value pair.
func RangeLocationParser ¶
RangeLocationParser attempts to parse a RangeLocation.
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 ¶
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 ¶
AmbiguousLocation represents an ambiguous location.
func NewAmbiguousLocation ¶
func NewAmbiguousLocation(start, end int) *AmbiguousLocation
NewAmbiguousLocation creates a new 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 BetweenLocation ¶
BetweenLocation represents a location between two points.
func NewBetweenLocation ¶
func NewBetweenLocation(start, end int) *BetweenLocation
NewBetweenLocation creates a new BetweenLocation.
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 NewComplementLocation ¶
func NewComplementLocation(loc Location) *ComplementLocation
NewComplementLocation creates a new ComplementLocation.
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 Constructor ¶ added in v0.4.0
type Constructor func() interface{}
Constructor should construct an object.
type Date ¶ added in v0.4.0
type Date struct {
Year int `json:"year" yaml:"year" msgpack:"year"`
Month time.Month `json:"month" yaml:"month" msgpack:"month"`
Day int `json:"day" yaml:"day" msgpack:"day"`
}
Date represents a date stamp for record entries.
type Decodable ¶ added in v0.3.0
Decodable implements the DecodeWith method whch should decode the object using the given Decoder object.
type Decoder ¶ added in v0.3.0
type Decoder interface {
Decode(v interface{}) error
}
Decoder implement the Decode method for reading and decoding from an input stream to the object pointed by the given value.
func NewGobDecoder ¶ added in v0.3.0
NewGobDecoder creates a Gob Decoder.
func NewJSONDecoder ¶ added in v0.3.0
NewJSONDecoder creates a JSON Decoder.
func NewMsgpackDecoder ¶ added in v0.3.0
NewMsgpackDecoder creates a Msgpack Decoder.
func NewYAMLDecoder ¶ added in v0.3.0
NewYAMLDecoder creates a YAML Decoder.
type DecoderConstructor ¶ added in v0.3.0
DecoderConstructor represents a constuctor function for a Decoder.
type Encodable ¶ added in v0.3.0
Encodable implements the EncodeTo method which should encode the object using the given Encoder object.
type Encoder ¶ added in v0.3.0
type Encoder interface {
Encode(v interface{}) error
}
Encoder implements the Encode method for encoding and writing the given object in some serialized form.
func NewGobEncoder ¶ added in v0.4.0
NewGobEncoder creates a Gob Encoder.
func NewJSONEncoder ¶ added in v0.4.0
NewJSONEncoder creates a JSON Encoder.
func NewMsgpackEncoder ¶ added in v0.4.0
NewMsgpackEncoder creates a Msgpack Encoder.
func NewYAMLEncoder ¶ added in v0.4.0
NewYAMLEncoder creates a YAML Encoder.
type EncoderConstructor ¶ added in v0.3.0
EncoderConstructor represents a constuctor function for an Encoder.
type EncoderWriter ¶ added in v0.6.0
type EncoderWriter struct {
// contains filtered or unexported fields
}
EncoderWriter provides an interface for encoding objects with the given Encoder.
func NewEncoderWriter ¶ added in v0.6.0
func NewEncoderWriter(v interface{}, ctor EncoderConstructor) EncoderWriter
NewEncoderWriter creates a new EncoderWriter.
type Fasta ¶ added in v0.6.0
Fasta represents a FASTA sequence object.
func (Fasta) Info ¶ added in v0.6.0
func (f Fasta) Info() interface{}
Info returns the metadata of the sequence.
func (*Fasta) Replace ¶ added in v0.6.0
Replace the bases from the specified position with the given sequence.
type FastaWriter ¶ added in v0.6.0
type FastaWriter struct {
// contains filtered or unexported fields
}
FastaWriter attempts to format a sequence in FASTA format.
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 ¶
NewFeature creates a new feature.
func (*Feature) DecodeMsgpack ¶ added in v0.3.0
DecodeMsgpack satisifes the msgpack.CustomDecoder interface.
func (*Feature) DecodeWith ¶ added in v0.3.0
DecodeWith satisifes the Decodable interface.
func (Feature) EncodeMsgpack ¶ added in v0.3.0
EncodeMsgpack satisifes the msgpack.CustomEncoder interface.
func (Feature) EncodeWith ¶ added in v0.3.0
EncodeWith satisfies the Encodable interface.
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) Info ¶ added in v0.6.0
func (f Feature) Info() interface{}
Info returns the metadata of the sequence.
func (Feature) MarshalJSON ¶ added in v0.3.0
MarshalJSON satisifes the json.Marshaler interface.
func (Feature) MarshalYAML ¶ added in v0.3.0
MarshalYAML satisfies the yaml.Marshaler interface.
func (Feature) Translation ¶
Translation returns the translation of the feature if available. it will return nil otherwise.
func (*Feature) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON satisifes the json.Unmarshaler interface.
type FeatureFilter ¶ added in v0.1.0
FeatureFilter represents a filter for selecting features.
func And ¶
func And(ss ...FeatureFilter) FeatureFilter
And returns true if all selectors return true.
func Key ¶
func Key(key string) FeatureFilter
Key returns true if the key of a feature matches the given key.
func Not ¶
func Not(s FeatureFilter) FeatureFilter
Not returns true if the given selector returns false.
func Or ¶
func Or(ss ...FeatureFilter) FeatureFilter
Or returns true if any of the selectors return true.
type FeatureFormatter ¶
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.
type FeatureIO ¶ added in v0.3.0
type FeatureIO struct {
Key string `json:"key" yaml:"key" msgpack:"key"`
Location string `json:"location" yaml:"location" msgpack:"location"`
Qualifiers []Qualifier `json:"qualifiers,omitempty" yaml:"qualifiers,omitempty" msgpack:"qualifiers,omitempty"`
}
FeatureIO represents a temporary object for reading and writing a Feature struct using various serialization libraries.
func NewFeatureIO ¶ added in v0.3.0
NewFeatureIO creates a new FeatureIO object.
func (FeatureIO) SetFeature ¶ added in v0.4.0
SetFeature sets the fields of the given Feature pointer.
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) Filter ¶ added in v0.1.0
func (ff FeatureList) Filter(ss ...FeatureFilter) []Feature
Filter the features in the list matching the selector criteria.
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.
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.
type FeatureTable ¶
type FeatureTable interface {
Filter(ss ...FeatureFilter) []Feature
Add(f Feature)
}
FeatureTable represents a feature table.
type FileType ¶ added in v0.4.0
type FileType int
FileType represents a file type.
const ( DefaultFile FileType = iota UnknownFile JSONFile YAMLFile MsgpackFile FastaFile FastqFile GenBankFile EMBLFile )
Available file types in GTS.
func Detect ¶ added in v0.4.0
Detect returns the FileType associated to extension of the given filename.
func ToFileType ¶ added in v0.4.0
ToFileType converts the file type name string to a FileType
type GTS ¶ added in v0.6.0
type GTS struct {
// contains filtered or unexported fields
}
GTS represents the most basic GTS sequence object.
func (GTS) Info ¶ added in v0.6.0
func (seq GTS) Info() interface{}
Info returns the metadata of the sequence.
type GenBank ¶
type GenBank struct {
Fields GenBankFields
Features FeatureList
Origin SequenceServer
}
GenBank represents a GenBank sequence record.
func (*GenBank) DecodeMsgpack ¶ added in v0.3.0
DecodeMsgpack satisifes the msgpack.CustomDecoder interface.
func (*GenBank) DecodeWith ¶ added in v0.3.0
DecodeWith satisifes the Decodable interface.
func (GenBank) EncodeMsgpack ¶ added in v0.3.0
EncodeMsgpack satisifes the msgpack.CustomEncoder interface.
func (GenBank) EncodeWith ¶ added in v0.3.0
EncodeWith satisfies the Encodable interface.
func (GenBank) Filter ¶ added in v0.1.0
func (gb GenBank) Filter(ss ...FeatureFilter) []Feature
Filter the features in the list matching the selector criteria.
func (GenBank) Info ¶ added in v0.6.0
func (gb GenBank) Info() interface{}
Info returns the metadata of the sequence.
func (GenBank) MarshalJSON ¶ added in v0.3.0
MarshalJSON satisifes the json.Marshaler interface.
func (GenBank) MarshalYAML ¶ added in v0.3.0
MarshalYAML satisifes the yaml.Marshaler interface.
func (*GenBank) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON satisifes the json.Unmarshaler interface.
func (*GenBank) UnmarshalYAML ¶ added in v0.3.0
UnmarshalYAML satisifes the yaml.Unmarshaler interface.
type GenBankFields ¶
type GenBankFields struct {
LocusName string `json:"locus_name" yaml:"locus_name" msgpack:"locus_name"`
Molecule string `json:"molecule" yaml:"molecule" msgpack:"molecule"`
Topology string `json:"topology" yaml:"topology" msgpack:"topology"`
Division string `json:"division" yaml:"division" msgpack:"division"`
Date Date `json:"date" yaml:"date" msgpack:"date"`
Definition string `json:"definition" yaml:"definition" msgpack:"definition"`
Accession string `json:"accession" yaml:"accession" msgpack:"accession"`
Version string `json:"version" yaml:"version" msgpack:"version"`
DBLink PairList `json:"dblink" yaml:"dblink" msgpack:"dblink"`
Keywords []string `json:"keywords,omitempty" yaml:"keywords,omitempty" msgpack:"keywords,omitempty"`
Source Organism `json:"source" yaml:"source" msgpack:"source"`
References []Reference `json:"references,omitempty" yaml:"references,omitempty" msgpack:"references,omitempty"`
Comment string `json:"comment" yaml:"comment" msgpack:"comment"`
}
GenBankFields represents the fields of a GenBank record other than the features and sequence.
type GenBankIO ¶ added in v0.3.0
type GenBankIO struct {
Fields GenBankFields `json:"fields" yaml:"fields" msgpack:"fields"`
Features []FeatureIO `json:"features" yaml:"features" msgpack:"features"`
Origin []byte `json:"origin" yaml:"origin" msgpack:"origin"`
}
GenBankIO represents a temporary object for reading and writing a GenBank struct using various serialization libraries.
func NewGenBankIO ¶ added in v0.3.0
NewGenBankIO creates a new GenBankIO object.
func (GenBankIO) SetGenBank ¶ added in v0.4.0
SetGenBank sets the fields of the given GenBank pointer.
type GenBankWriter ¶ added in v0.6.0
type GenBankWriter struct {
// contains filtered or unexported fields
}
GenBankWriter attempts to format a record in GenBank flatfile format.
type JoinLocation ¶
type JoinLocation struct {
Locations []Location
}
JoinLocation represents multiple joined locations.
func NewJoinLocation ¶
func NewJoinLocation(locs []Location) *JoinLocation
NewJoinLocation creates a new JoinLocation.
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 ¶
AsLocation attempts to interpret the given string as a Location.
type MultiParserScanner ¶ added in v0.4.0
type MultiParserScanner struct {
// contains filtered or unexported fields
}
MultiParserScanner tests for a matching parser on the first Scan and will attempt to use the same parser for the subsequent calls to Scan.
func NewMultiParserScanner ¶ added in v0.4.0
func NewMultiParserScanner(r io.Reader, ii ...interface{}) *MultiParserScanner
NewMultiParserScanner creates a new MultiParserScanner.
func (MultiParserScanner) Err ¶ added in v0.4.0
func (s MultiParserScanner) Err() error
Err returns the first non-EOF error that was encountered by the Scanner.
func (*MultiParserScanner) Scan ¶ added in v0.4.0
func (s *MultiParserScanner) Scan() bool
Scan advances the scanner using the given parsers. The first Scan can match any of the given parsers. All subsequent calls to Scan will require the same parser to match continually.
func (MultiParserScanner) Value ¶ added in v0.4.0
func (s MultiParserScanner) Value() interface{}
Value returns the most recent result value generated by one of the parsers.
type MutableSequence ¶
type MutableSequence interface {
Insert(pos int, arg Sequence) error
Delete(pos, arg int) error
Replace(pos int, arg 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 NewOrderLocation ¶
func NewOrderLocation(locs []Location) *OrderLocation
NewOrderLocation creates a new OrderLocation.
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 `json:"species" yaml:"species" msgpack:"species"`
Name string `json:"name" yaml:"name" msgpack:"name"`
Taxon []string `json:"taxon,omitempty" yaml:"taxon,omitempty" msgpack:"taxon,omitempty"`
}
Organism represents an organism of a record.
type Pair ¶
type Pair struct {
Key string `json:"key" yaml:"key" msgpack:"key"`
Value string `json:"value" yaml:"value" msgpack:"value"`
}
Pair represents a pair of strings.
type ParserScanner ¶ added in v0.4.0
type ParserScanner struct {
// contains filtered or unexported fields
}
ParserScanner provides a convenient interface for continually matching a parser.
func NewParserScanner ¶ added in v0.4.0
func NewParserScanner(r io.Reader, i interface{}) *ParserScanner
NewParserScanner creates a new ParserScanner.
func (ParserScanner) Err ¶ added in v0.4.0
func (s ParserScanner) Err() error
Err returns the first non-EOF error that was encountered by the Scanner.
func (*ParserScanner) Scan ¶ added in v0.4.0
func (s *ParserScanner) Scan() bool
Scan advances the scanner using the given parser.
func (ParserScanner) Value ¶ added in v0.4.0
func (s ParserScanner) Value() interface{}
Value returns the most recent result value generated by the parser.
type PointLocation ¶
type PointLocation struct{ Position int }
PointLocation represents a single point.
func NewPointLocation ¶
func NewPointLocation(pos int) *PointLocation
NewPointLocation creates a new PointLocation.
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 [2]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.
type QualifierFormatter ¶
QualifierFormatter formats a Qualifier object with the given prefix.
func (QualifierFormatter) String ¶
func (qf QualifierFormatter) String() string
String satisfies the fmt.Stringer 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 RangeLocation ¶
RangeLocation represents a range of locations.
func NewPartialRangeLocation ¶
func NewPartialRangeLocation(start, end int, p5, p3 bool) *RangeLocation
NewPartialRangeLocation creates a new partial RangeLocation.
func NewRangeLocation ¶
func NewRangeLocation(start, end int) *RangeLocation
NewRangeLocation creates a new RangeLocation.
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 {
FeatureTable
MutableSequence
}
Record is the interface for sequence records with metadata and features.
type RecordScanner ¶
type RecordScanner struct {
// contains filtered or unexported fields
}
RecordScanner scans one sequence record at a time.
func NewRecordFileScanner ¶ added in v0.4.0
func NewRecordFileScanner(f *os.File) *RecordScanner
NewRecordFileScanner creates a new specialized RecordScanner based on the given filename.
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 `json:"number" yaml:"number" msgpack:"number"`
Ranges []Range `json:"ranges,omitempty" yaml:"ranges,omitempty" msgpack:"ranges,omitempty"`
Authors string `json:"authors" yaml:"authors" msgpack:"authors"`
Group string `json:"group" yaml:"group" msgpack:"group"`
Title string `json:"title" yaml:"title" msgpack:"title"`
Journal string `json:"journal" yaml:"journal" msgpack:"journal"`
Xref map[string]string `json:"xref,omitempty" yaml:"xref,omitempty" msgpack:"xref,omitempty"`
Comment string `json:"comment" yaml:"comment" msgpack:"comment"`
}
Reference represents a reference of a record.
type Sequence ¶
type Sequence interface {
Info() interface{}
Bytes() []byte
}
Sequence represents a sequence type. All Sequence types must be able to generate a byte slice representation of itself.
func Complement ¶
Complement returns the complement of the given sequence.
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, arg int) error
Delete given number of bases from the specified position.
func (SequenceProxy) Info ¶ added in v0.6.0
func (sp SequenceProxy) Info() interface{}
Info satisfies the gts.Sequence interface.
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, arg int) error
Delete given number of bases from the specified position.
func (SequenceServer) Info ¶ added in v0.6.0
func (ss SequenceServer) Info() interface{}
Info satisfies the gts.Sequence interface.
func (*SequenceServer) Insert ¶
func (ss *SequenceServer) Insert(pos int, arg 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, arg 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 ¶
Values represents a collection of name-value list pairs.