Documentation
¶
Overview ¶
Package obo provides functions for reading, writing, and manipulating Open Biomedical Ontologies (obo) format files. This package follows the OBO Flat File Format 1.4, as specified here: http://owlcollab.github.io/oboformat/doc/obo-syntax.html
Index ¶
- func AllAreEqual(a map[string]*Obo, b map[string]*Obo) bool
- func Equal(a Obo, b Obo) bool
- func EqualHeader(a Header, b Header) bool
- func IsADescriptionToString(d IsADescription) string
- func NumberOfDescendents(termMap map[string]*Obo)
- func SubTreeReport(outFile string, records map[string]*Obo)
- func SubtreeToDot(outFile string, nodeId string, termMap map[string]*Obo)
- func ToDot(outFile string, terms map[string]*Obo)
- func ToString(o Obo) string
- func Write(filename string, records map[string]*Obo, header Header)
- func WriteHeaderToFileHandle(file io.Writer, header Header)
- func WriteObo(file io.Writer, input Obo)
- type Header
- type IsADescription
- type Obo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllAreEqual ¶
AllAreEqual returns true if two input slices of Obo structs are identical.
func EqualHeader ¶
EqualHeader returns true if two input Header structs have the same data.
func IsADescriptionToString ¶
func IsADescriptionToString(d IsADescription) string
IsADescriptionToString converts an IsADescription struct into a string.
func NumberOfDescendents ¶
NumberOfDescendents edits the field SubTreeSize of input Obo structs to the number of descendent nodes in a subtree rooted on a particular node.
func SubTreeReport ¶
SubTreeReport writes out the number of descendent nodes for each node in an Obo tree. This is used for debugging, and for picking subtrees to visualize based on size.
func SubtreeToDot ¶
SubtreeToDot makes a DOT format tree for the subtree rooted at the input nodeId. BuildTree must have been run on this tree already, as termMap is an argument.
func ToDot ¶
ToDot formats an input Obo slice as a tree and writes the resulting tree to a file in DOT format. If "force" is true, we will build a tree from the Obo even in the case of a nil parent pointer for an individual Obo element.
func ToString ¶
ToString converts an Obo struct into an OBO file format string. Used for writing to files or printing.
func WriteHeaderToFileHandle ¶
WriteHeaderToFileHandle writes an Obo header to an io.Writer.
Types ¶
type Header ¶
type Header struct {
Text []string
}
Header encodes the header of an Obo file. Header lines are not marked by a leading character, but are defined as lines preceding the first instance of '[Term]'.
func ReadHeader ¶
func ReadHeader(file *fileio.EasyReader) Header
ReadHeader processes the contiguous header from an EasyReader and advances the Reader past the header lines. Note that Header lines are not marked by a leading\ character, but are defined as lines preceding the first instance of '[Term]'.
type IsADescription ¶
IsADescription contains the information in the "IsA" field of an Obo record.
func (IsADescription) String ¶
func (d IsADescription) String() string
String is a method for IsADescription which formats an input struct as a string.
type Obo ¶
type Obo struct {
Id string // Required, can only appear once. GO ID. Ex. GO:0000001
Name string // Required, can only appear once. GO Name. Ex. http://owlcollab.github.io/oboformat/doc/obo-syntax.html
NameSpace string // Required, can only appear once. The category or domain of the term. Ex. biological_process
Def string // Required, can only appear once. Sentence definition of the term.
IsObsolete bool // Optional. Can only appear once. Specifies obsolete ontology labels, which can be filtered downstream.
IsA []IsADescription // Optional. Can appear multiple times in an entry. Specifies parent nodes. Ex. is_a: GO:0048308 ! organelle inheritance // is_a: GO:0048311 ! mitochondrion distribution
Synonyms []string // Optional. Can appear multiple times in an entry. Specifies alternative names for term.
XRefs []string // Optional. Can appear multiple times in an entry. Specifies an external reference about the term. Ex. Wikipedia:Reproduction
AltIds []string // Optional. Can appear multiple times in an entry. Specify an alternative GO ID that also points to this entry.
Relationships []string // Optional. Can appear multiple times in an entry. Specifies relationships between ontologies other than 'is_a'.
Comments []string // Optional. Can appear multiple times in an entry. Stores additional comments about an ontology.
OtherFields map[string][]string // Catch all for other field names.
Parents []*Obo // Parent nodes of this ontology.
Children []*Obo // Child nodes of this ontology.
SubTreeSize int //Total number of descendents.
}
Obo is a struct representing one node in an Obo format file, or one ontology term. Required and relevant fields are parsed. As this format is quite flexible and permissive, all other fields will be added to 'OtherFields'. Go:0000001 from the GO Catalog is used for examples of each field.
func FindTreeRoots ¶ added in v1.0.1
FindTreeRoots takes a map[string]*Obo and returns a slice of pointers to all root nodes. This function assumes BuildTree has already been called.