Documentation ¶
Index ¶
- Variables
- func AddPrefix(s, prefix string) string
- func FlatFileSplit(s string) []string
- func GenBankParser(state *pars.State, result *pars.Result) error
- func INSDCTableParser(prefix string) pars.Parser
- func IsLiteralQualifier(name string) bool
- func IsQuotedQualifier(name string) bool
- func IsToggleQualifier(name string) bool
- func QualifierParser(prefix string) pars.Parser
- func RegisterLiteralQualifier(names ...string)
- func RegisterQuotedQualifier(names ...string)
- func RegisterToggleQualifier(names ...string)
- type AutoWriter
- type Contig
- type Date
- type Dictionary
- type ExtraField
- type Fasta
- type FastaWriter
- type FieldFormatter
- type FileType
- type GenBank
- func (gb GenBank) Bytes() []byte
- func (gb GenBank) Features() gts.FeatureSlice
- func (gb GenBank) Info() interface{}
- func (gb GenBank) Len() int
- func (gb GenBank) String() string
- func (gb GenBank) WithBytes(p []byte) gts.Sequence
- func (gb GenBank) WithFeatures(ff []gts.Feature) gts.Sequence
- func (gb GenBank) WithInfo(info interface{}) gts.Sequence
- func (gb GenBank) WithTopology(t gts.Topology) gts.Sequence
- func (gb GenBank) WriteTo(w io.Writer) (int64, error)
- type GenBankFields
- type GenBankWriter
- type INSDCFormatter
- type Organism
- type Origin
- type Pair
- type QualifierFormatter
- type QualifierIO
- type QualifierType
- type Reference
- type Scanner
- type SeqWriter
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 FastaParser = pars.Seq( '>', pars.Line, pars.Until(pars.Any('>', pars.End)), ).Map(func(result *pars.Result) error { desc := string(result.Children[1].Token) body := result.Children[2].Token lines := bytes.Split(body, []byte{'\n'}) data := bytes.Join(lines, nil) result.SetValue(Fasta{desc, data}) return nil })
FastaParser attempts to parse a single FASTA file entry.
Functions ¶
func FlatFileSplit ¶
FlatFileSplit splits the string with the flatfile convention.
func GenBankParser ¶
GenBankParser attempts to parse a single GenBank record.
func INSDCTableParser ¶ added in v0.27.1
INSDCTableParser attempts to match an INSDC feature table.
func IsLiteralQualifier ¶ added in v0.27.1
IsLiteralQualifier tests if the given qualifier name is a literal qualifier.
func IsQuotedQualifier ¶ added in v0.27.1
IsQuotedQualifier tests if the given qualifier name is a quoted qualifier.
func IsToggleQualifier ¶ added in v0.27.1
IsToggleQualifier tests if the given qualifier name is a toggle qualifier.
func QualifierParser ¶ added in v0.27.1
QualifierParser attempts to match a single qualifier name-value pair.
func RegisterLiteralQualifier ¶ added in v0.27.1
func RegisterLiteralQualifier(names ...string)
RegisterLiteralQualifier registers the given qualifier names as being a literal qualifier (i.e. /name=value).
func RegisterQuotedQualifier ¶ added in v0.27.1
func RegisterQuotedQualifier(names ...string)
RegisterQuotedQualifier registers the given qualifier names as being a quoted qualifer (i.e. /name="value").
func RegisterToggleQualifier ¶ added in v0.27.1
func RegisterToggleQualifier(names ...string)
RegisterToggleQualifier registers the given qualifier names as being a toggle qualifier (i.e. /name).
Types ¶
type AutoWriter ¶ added in v0.28.0
type AutoWriter struct {
// contains filtered or unexported fields
}
type Date ¶ added in v0.11.7
Date represents a date stamp for record entries.
type Dictionary ¶ added in v0.11.6
type Dictionary []Pair
Dictionary represents an ordered key-value pair.
func (*Dictionary) Del ¶ added in v0.11.6
func (d *Dictionary) Del(key string)
Del removes the value associated to the given key.
func (*Dictionary) Get ¶ added in v0.11.6
func (d *Dictionary) Get(key string) []string
Get the value associated to the given key.
func (*Dictionary) Set ¶ added in v0.11.6
func (d *Dictionary) Set(key, value string)
Set the value associated to the given key.
type ExtraField ¶ added in v0.24.3
ExtraField represents an uncommon field of a genome flat-file.
func GenBankExtraField ¶ added in v0.24.3
func GenBankExtraField(name, value string) ExtraField
GenBankExtraField creates a new extra field with a default formatter.
func (ExtraField) String ¶ added in v0.24.3
func (field ExtraField) String() string
String satisfies the fmt.Stringer interface.
type Fasta ¶
Fasta represents a FASTA format sequence object.
func (Fasta) Features ¶
func (f Fasta) Features() gts.FeatureSlice
Features returns the feature table of the sequence.
type FastaWriter ¶ added in v0.28.0
type FastaWriter struct {
// contains filtered or unexported fields
}
FastaWriter writes a gts.Sequence to an io.Writer in FASTA format.
type FieldFormatter ¶ added in v0.24.3
FieldFormatter represents a function for formatting a field.
type FileType ¶
type FileType int
FileType represents a file type.
Available file types in GTS.
func ToFileType ¶
ToFileType converts the file type name string to a FileType
type GenBank ¶
type GenBank struct { Fields GenBankFields Table gts.FeatureSlice Origin *Origin }
GenBank represents a GenBank sequence record.
func (GenBank) Features ¶
func (gb GenBank) Features() gts.FeatureSlice
Features returns the feature table of the sequence.
func (GenBank) Info ¶
func (gb GenBank) Info() interface{}
Info returns the metadata of the sequence.
func (GenBank) WithBytes ¶
WithBytes creates a shallow copy of the given Sequence object and swaps the byte representation with the given byte slice.
func (GenBank) WithFeatures ¶
WithFeatures creates a shallow copy of the given Sequence object and swaps the feature table with the given features.
func (GenBank) WithInfo ¶
WithInfo creates a shallow copy of the given Sequence object and swaps the metadata with the given value.
func (GenBank) WithTopology ¶ added in v0.12.0
WithTopology creates a shallow copy of the given Sequence object and swaps the topology value with the given value.
type GenBankFields ¶
type GenBankFields struct { LocusName string Molecule gts.Molecule Topology gts.Topology Division string Date Date Definition string Accession string Version string DBLink Dictionary Keywords []string Source Organism References []Reference Comments []string Extra []ExtraField Contig Contig Region gts.Region // Appears in sliced files. }
GenBankFields represents the fields of a GenBank record other than the features and sequence.
func (GenBankFields) ID ¶ added in v0.21.0
func (gbf GenBankFields) ID() string
ID returns the ID of the sequence.
func (GenBankFields) Slice ¶ added in v0.23.0
func (gbf GenBankFields) Slice(start, end int) interface{}
Slice returns a metadata sliced with the given region.
func (GenBankFields) String ¶
func (gbf GenBankFields) String() string
String satisifes the fmt.Stringer interface.
type GenBankWriter ¶ added in v0.28.0
type GenBankWriter struct {
// contains filtered or unexported fields
}
GenBankWriter writes a gts.Sequence to an io.Writer in GenBank format.
type INSDCFormatter ¶ added in v0.27.1
INSDCFormatter formats a Feature object with the given prefix and depth.
func (INSDCFormatter) String ¶ added in v0.27.1
func (fmtr INSDCFormatter) String() string
String satisfies the fmt.Stringer interface.
type Origin ¶
Origin represents a GenBank sequence origin value.
func (*Origin) Bytes ¶ added in v0.16.0
Bytes converts the GenBank sequence origin into a byte slice.
type QualifierFormatter ¶ added in v0.27.1
type QualifierFormatter struct { Qualifier QualifierIO Prefix string }
QualifierFormatter formats a QualifierIO object with the given prefix.
func (QualifierFormatter) String ¶ added in v0.27.1
func (qf QualifierFormatter) String() string
String satisfies the fmt.Stringer interface.
type QualifierIO ¶ added in v0.27.1
type QualifierIO [2]string
QualifierIO represents a single qualifier name-value pair.
func (QualifierIO) Format ¶ added in v0.27.1
func (q QualifierIO) Format(prefix string) QualifierFormatter
Format creates a QualifierFormatter object for the qualifier with the given prefix.
func (QualifierIO) String ¶ added in v0.27.1
func (q QualifierIO) String() string
String satisfies the fmt.Stringer interface.
func (QualifierIO) Unpack ¶ added in v0.27.1
func (q QualifierIO) Unpack() (string, string)
Unpack returns the name and value strings of the QualifierIO.
type QualifierType ¶ added in v0.27.1
type QualifierType int
QualifierType represents the type of qualifier.
const ( QuotedQualifier QualifierType = iota LiteralQualifier ToggleQualifier UnknownQualifier )
Available qualifier types.
func GetQualifierType ¶ added in v0.27.1
func GetQualifierType(name string) QualifierType
GetQualifierType returns the qualifier type of the given qualifier name.
type Reference ¶ added in v0.11.6
type Reference struct { Number int Info string Authors string Group string Title string Journal string Xref map[string]string Comment string }
Reference represents a reference of a record.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a sequence file scanner.
func NewAutoScanner ¶
NewAutoScanner creates a new sequence scanner which will automatically detect the sequence format from a list of known parsers on the first scan.
func NewScanner ¶
NewScanner creates a new sequence scanner.