rhea

package
v0.0.0-...-9621b0d Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRheaToUniprotTsv

func ParseRheaToUniprotTsv(r io.Reader, lines chan<- RheaToUniprot)

ParseRheaToUniprotTsv parses a rhea2uniprot TSV file and sends values to a channel.

func ReadGzippedXml

func ReadGzippedXml(gzipPath string) ([]byte, error)

ReadGzippedXml reads in a a gzip'd Rhea dump (https://www.rhea-db.org/help/download) into bytes.

func ReadRheaToUniprotSprot

func ReadRheaToUniprotSprot(path string, lines chan RheaToUniprot)

ReadRheaToUniprotSprot reads in the rhea2uniprot sprot TSV file (not gzipped) and sends values into a channel.

func ReadRheaToUniprotTrembl

func ReadRheaToUniprotTrembl(path string, lines chan RheaToUniprot)

ReadRheaToUniprotTrembl reads in the rhea2uniprot trembl TSV file (gzipped) and sends values into channel.

Types

type BidirectionalReaction

type BidirectionalReaction struct {
	XMLName  xml.Name `xml:"bidirectionalReaction"`
	Resource string   `xml:"resource,attr"`
}

BidirectionalReaction is an XML representation of a Rhea bidirectional reaction.

type ChEBIXML

type ChEBIXML struct {
	XMLName  xml.Name `xml:"chebi"`
	Resource string   `xml:"resource,attr"`
}

ChEBIXML is an XML representation of a ChEBI.

type Citation

type Citation struct {
	XMLName  xml.Name `xml:"citation"`
	Resource string   `xml:"resource,attr"`
}

Citation is an XML representation of a citation of a description.

type Compound

type Compound struct {
	ID                  int    `json:"id" db:"id"`
	Accession           string `json:"accession" db:"accession"`
	Position            string `json:"position" db:"position"`
	Name                string `json:"name" db:"name"`
	HTMLName            string `json:"htmlName" db:"htmlname"`
	Formula             string `json:"formula" db:"formula"`
	Charge              string `json:"charge" db:"charge"`
	ChEBI               string `json:"chebi" db:"chebi"`
	SubclassOfChEBI     string `json:"subclassOfChEBI"`
	PolymerizationIndex string `json:"polymerizationIndex" db:"polymerizationindex"`
	CompoundID          int    `json:"compoundid" db:"compoundid"`
	CompoundAccession   string `json:"compoundaccession" db:"compoundaccession"`
	CompoundName        string `json:"compoundname" db:"compoundname"`
	CompoundHTMLName    string `json:"compoundhtmlName" db:"compoundhtmlname"`
	CompoundType        string `json:"compoundType" db:"compoundtype"`
}

Compound is a struct of a Rhea compound. These are chemicals - sometimes they are complicated chemicals like proteins or polymers, but often they are simple molecules. When Compounds are complicated molecules, like proteins, they can have reactiveParts that actually do the reactions. Compound, as defined here, is a pair containing a macro-molecule and a reactivePart. When building into a database, you will have to split this pairing for normalization.

func NewCompound

func NewCompound(description Description, subclass Subclass) Compound

NewCompound returns a Compound.

type CompoundXML

type CompoundXML struct {
	XMLName  xml.Name `xml:"compound"`
	Resource string   `xml:"resource,attr"`
}

CompoundXML is an XML representation of a compound.

type Contains

type Contains struct {
	XMLName  xml.Name `xml:"contains"`
	Resource string   `xml:"resource,attr"`
}

Contains is an XML representation of what Compound a ReactionParticipant contains.

type ContainsX

type ContainsX struct {
	XMLName xml.Name
	Content string `xml:"resource,attr"`
}

ContainsX is a catch-all XML representation of how many compounds a ReactionParticipant would use.

type Description

type Description struct {
	// Reaction
	XMLName              xml.Name             `xml:"Description"`
	About                string               `xml:"about,attr"`
	ID                   int                  `xml:"id"`
	Accession            string               `xml:"accession"` // Accession refers to a Rhea accession number
	Equation             string               `xml:"equation"`
	HTMLEquation         string               `xml:"htmlEquation"`
	IsChemicallyBalanced bool                 `xml:"isChemicallyBalanced"`
	IsTransport          bool                 `xml:"isTransport"`
	Citations            []Citation           `xml:"citation"`
	Substrates           []Substrate          `xml:"substrates"`
	Products             []Product            `xml:"products"`
	SubstrateOrProducts  []SubstrateOrProduct `xml:"substratesOrProducts"`
	Subclass             []Subclass           `xml:"subClassOf"`
	Comment              string               `xml:"comment"`
	EC                   EC                   `xml:"ec"`
	Status               Status               `xml:"status"`
	Compound             CompoundXML          `xml:"compound"`

	// ReactionSide / Reaction Participant
	BidirectionalReactions []BidirectionalReaction `xml:"bidirectionalReaction"`
	DirectionalReactions   []DirectionalReaction   `xml:"directionalReaction"`
	Side                   Side                    `xml:"side"`
	SeeAlsos               SeeAlso                 `xml:"seeAlso"`
	TransformableTo        TransformableTo         `xml:"transformableTo"`
	CuratedOrder           int                     `xml:"curatedOrder"`
	Contains               Contains                `xml:"contains"`

	// ContainsX contains all other name-attribute pairs, with names like "contains1" in mind
	ContainsX []ContainsX `xml:",any"`

	// Small Molecule tags
	Name     string   `xml:"name"`
	HTMLName string   `xml:"htmlName"`
	Formula  string   `xml:"formula"`
	Charge   string   `xml:"charge"`
	ChEBI    ChEBIXML `xml:"chebi"`

	// Generic Compound
	ReactivePartXML ReactivePartXML `xml:"reactivePart"`

	// ReactivePart
	Position string `xml:"position"`

	// Polymer
	UnderlyingChEBI     UnderlyingChEBI `xml:"underlyingChEBI"`
	PolymerizationIndex string          `xml:"polymerizationIndex"`

	// Transport
	Location Location `xml:"location"`
}

Description is the XML representation of an object in the Rhea database.

func (*Description) CitationStrings

func (d *Description) CitationStrings() []string

CitationStrings gives a list of citation strings from a description.

func (*Description) ProductAccessionIDs

func (d *Description) ProductAccessionIDs() []string

ProductAccessionIDs gives a list of product accessions from a description.

func (*Description) SubstrateAccessionIDs

func (d *Description) SubstrateAccessionIDs() []string

SubstrateAccessionIDs gives a list of substrate accessions from a description.

func (*Description) SubstrateOrProductAccessionIDs

func (d *Description) SubstrateOrProductAccessionIDs() []string

SubstrateOrProductAccessionIDs gives a list of substrateOrProduct accessions from a description.

type DirectionalReaction

type DirectionalReaction struct {
	XMLName  xml.Name `xml:"directionalReaction"`
	Resource string   `xml:"resource,attr"`
}

DirectionalReaction is an XML representation of a Rhea directional reaction.

type EC

type EC struct {
	XMLName  xml.Name `xml:"ec"`
	Resource string   `xml:"resource,attr"`
}

EC is an XML representation of an EC number (Enzyme Commission Number) of a description.

type Location

type Location struct {
	XMLName  xml.Name `xml:"location"`
	Resource string   `xml:"resource,attr"`
}

Location is an XML representation of Locations in a cell, usually referring to transport enzymes.

type Product

type Product struct {
	XMLName  xml.Name `xml:"products"`
	Resource string   `xml:"resource,attr"`
}

Product is an XML representation of a product.

type Rdf

type Rdf struct {
	XMLName      xml.Name      `xml:"RDF"`
	Descriptions []Description `xml:"Description"`
}

Rdf is the RDF XML representation of the Rhea database.

type Reaction

type Reaction struct {
	ID                   int      `json:"id" db:"id"`
	Directional          bool     `json:"directional" db:"directional"`
	Accession            string   `json:"accession" db:"accession"`
	Status               string   `json:"status" db:"status"`
	Comment              string   `json:"comment" db:"comment"`
	Equation             string   `json:"equation" db:"equation"`
	HTMLEquation         string   `json:"htmlequation" db:"htmlequation"`
	IsChemicallyBalanced bool     `json:"ischemicallybalanced" db:"ischemicallybalanced"`
	IsTransport          bool     `json:"istransport" db:"istransport"`
	Ec                   string   `json:"ec" db:"ec"`
	Location             string   `json:"location" db:"location"`
	Citations            []string `json:"citations"`
	Substrates           []string `json:"substrates"`
	Products             []string `json:"products"`
	SubstrateOrProducts  []string `json:"substrateOrProducts"`
}

Reaction represents a Rhea reaction. Substrates, Products, and SubstrateOrProducts are all ReactionSide accession numbers, which can be linked to the ReactionParticipant's ReactionSide accession

func NewReaction

func NewReaction(description Description, subclass Subclass) Reaction

NewReaction returns a Reaction.

type ReactionParticipant

type ReactionParticipant struct {
	ReactionSide string `json:"reactionside" db:"reactionside"`
	Contains     int    `json:"contains" db:"contains"`
	ContainsN    bool   `json:"containsn" db:"containsn"`
	Minus        bool   `json:"minus" db:"minus"` // Only set to true if ContainsN == true to handle Nminus1
	Plus         bool   `json:"plus" db:"plus"`   // Only set to true if ContainsN == true to handle Nplus1
	Accession    string `json:"reactionParticipant" db:"ReactionParticipant"`
	Compound     string `json:"compound" db:"compound"`
}

ReactionParticipant represents a Rhea ReactionParticipant. ReactionParticipants represent Compounds in Reactions. They can contain many of the same Compounds (including polymerized configurations) and are associated with a ReactionSide.

func NewReactionParticipant

func NewReactionParticipant(description Description, containsx ContainsX, compoundParticipantMap map[string]string) (ReactionParticipant, error)

NewReactionParticipant returns a ReactionParticipant.

type ReactivePartXML

type ReactivePartXML struct {
	XMLName  xml.Name `xml:"reactivePart"`
	Resource string   `xml:"resource,attr"`
}

ReactivePartXML is an XML representation of a ReactivePart.

type Rhea

type Rhea struct {
	ReactionParticipants []ReactionParticipant `json:"reactionParticipants"`
	Compounds            []Compound            `json:"compounds"`
	Reactions            []Reaction            `json:"reactions"`
}

Rhea is a struct of the entire Rhea Database in a simplified higher-level way.

func Parse

func Parse(rheaBytes []byte) (Rhea, error)

Parse parses a list of bytes into a higher-level Rhea Struct.

func Read

func Read(path string) (Rhea, error)

Read reads in a gzip'd Rhea dump and converts it into a higher-level rhea struct.

func (*Rhea) ExportJSON

func (rhea *Rhea) ExportJSON() ([]byte, error)

ExportJSON exports Rhea as a JSON file

type RheaToUniprot

type RheaToUniprot struct {
	RheaID    int
	Direction string
	MasterID  int
	UniprotID string
}

RheaToUniprot represents a single line of the TSV file.

type SeeAlso

type SeeAlso struct {
	XMLName  xml.Name `xml:"seeAlso"`
	Resource string   `xml:"resource,attr"`
}

SeeAlso is an XML representation of a SeeAlso XML in a description.

type Side

type Side struct {
	XMLName  xml.Name `xml:"side"`
	Resource string   `xml:"resource,attr"`
}

Side is an XML representation of a Rhea ReactionSide.

type Status

type Status struct {
	XMLName  xml.Name `xml:"status"`
	Resource string   `xml:"resource,attr"`
}

Status is an XML representation of the current status of an description.

type Subclass

type Subclass struct {
	XMLName  xml.Name `xml:"subClassOf"`
	Resource string   `xml:"resource,attr"`
}

Subclass is an XML representation of a subclass, which can mean many different things in Rhea.

type Substrate

type Substrate struct {
	XMLName  xml.Name `xml:"substrates"`
	Resource string   `xml:"resource,attr"`
}

Substrate is an XML representation of a substrate.

type SubstrateOrProduct

type SubstrateOrProduct struct {
	XMLName  xml.Name `xml:"substratesOrProducts"`
	Resource string   `xml:"resource,attr"`
}

SubstrateOrProduct is an XML representation of a SubstrateOrProduct.

type TransformableTo

type TransformableTo struct {
	XMLName  xml.Name `xml:"transformableTo"`
	Resource string   `xml:"resource,attr"`
}

TransformableTo is an XML representation of a transformableTo in a description. This essentially links two ReactionSides in Rhea.

type UnderlyingChEBI

type UnderlyingChEBI struct {
	XMLName  xml.Name `xml:"underlyingChEBI"`
	Resource string   `xml:"resource,attr"`
}

UnderlyingChEBI is an XML representation of ChEBI that builds a Polymer.

Jump to

Keyboard shortcuts

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