molecule

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownAACode = errors.New("unknown amino acid code")

ErrUnknownAACode Single letter AA code unknown

Functions

func ChemicalFormula

func ChemicalFormula(m Molecule) (string, error)

ChemicalFormula a molecule to a string

func InitCommonMolecules

func InitCommonMolecules(e *elements.Elems)

InitCommonMolecules initializes some common molecules It only needs to be called in case elements.Elems is initialized with a non-standard table

Types

type AtomsCount

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

AtomsCount contains an atom index and atom count

func (*AtomsCount) IdxCount

func (ac *AtomsCount) IdxCount() (int, int)

IdxCount returns the index and count of an atom in a molecule

type Molecule

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

Molecule represents a single molecule

func Add

func Add(m1 Molecule, m2 Molecule) Molecule

Add two molecules. The atoms in the molecules must be sorted by atom index The molecules must use the same elements table (this is not checked) FIXME: handle situation where molecules have different element pointer

func AminoAcid

func AminoAcid(aa byte) (Molecule, error)

AminoAcid returns the molecule (minus H2O) for a single letter amino acid code

func PepProt

func PepProt(p string) (Molecule, error)

PepProt returns the molecule peptide or protein

func SimpleFormula

func SimpleFormula(f string, e *elements.Elems) (Molecule, error)

SimpleFormula converts a chemical formula to a structure that contains elements/atom counts

func (*Molecule) Atoms

func (m *Molecule) Atoms() []AtomsCount

Atoms returns the atoms/count of a molecule

Jump to

Keyboard shortcuts

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