peakml.chemistry
Class Molecule

java.lang.Object
  extended by peakml.chemistry.Molecule

public class Molecule
extends java.lang.Object

Implementation of a class tracking all the properties of a molecule. This can be used to load databases with molecule information from files with the peakml class.


Constructor Summary
Molecule(java.lang.String databaseid, java.lang.String name, double mass)
          Constructs a new Molecule instance with the given id, name and mass.
Molecule(java.lang.String databaseid, java.lang.String name, MolecularFormula formula)
          Constructs a new Molecule instance with the given id, name and molecular formula.
Molecule(java.lang.String databaseid, java.lang.String name, java.lang.String formula)
          Constructs a new Molecule instance with the given id, name and molecular formula.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.String getDatabaseID()
          Returns the unique id of the molecule.
 java.lang.String getDescription()
          Returns the optional description for the molecule.
 MolecularFormula getFormula()
          Returns the molecular formula of the molecule.
 java.lang.String getInChi()
          Returns the InChi string describing the molecular structure of the molecule.
 double getMass(Mass masstype)
          Returns the mass of the molecule.
 java.lang.String getName()
          Returns the name of the molecule.
 double getRetentionTime()
          Returns the optional expected retention time for this molecule.
 java.lang.String getSmiles()
          Returns the smiles string describing the molecular structure of the molecule.
 java.util.Vector<java.lang.String> getSynonyms()
          Returns the list of synonyms associated to this molecule.
 void setDatabaseID(java.lang.String id)
           
 void setDescription(java.lang.String description)
          Optional description for the molecule.
 void setInChi(java.lang.String inchi)
          Sets the InChi string describing the molecular structure of the molecule.
 void setName(java.lang.String name)
           
 void setRetentionTime(double rt)
          Sets the optional expected retention time for this molecule.
 void setSmiles(java.lang.String smiles)
          Sets the smiles string describing the molecular structure of the molecule.
 void setSynonyms(java.util.Collection<java.lang.String> synonyms)
          Adds the list of synonyms to the internal synonyms list.
 void setSynonyms(java.lang.String[] synonyms)
          Adds the list of synonyms to the internal synonyms list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Molecule

public Molecule(java.lang.String databaseid,
                java.lang.String name,
                java.lang.String formula)
Constructs a new Molecule instance with the given id, name and molecular formula.

Parameters:
databaseid - The unique id of the molecule.
name - The name of the molecule.
formula - The molecular formula of the molecule.

Molecule

public Molecule(java.lang.String databaseid,
                java.lang.String name,
                MolecularFormula formula)
Constructs a new Molecule instance with the given id, name and molecular formula.

Parameters:
databaseid - The unique id of the molecule.
name - The name of the molecule.
formula - The molecular formula of the molecule.

Molecule

public Molecule(java.lang.String databaseid,
                java.lang.String name,
                double mass)
Constructs a new Molecule instance with the given id, name and mass. This options has been included to support files with only mass information, but no formulae.

Parameters:
databaseid - The unique id of the molecule.
name - The name of the molecule.
mass - The mass of the molecule.
Method Detail

getDatabaseID

public java.lang.String getDatabaseID()
Returns the unique id of the molecule.

Returns:
The unique id of the molecule.

setDatabaseID

public void setDatabaseID(java.lang.String id)

getName

public java.lang.String getName()
Returns the name of the molecule.

Returns:
The name of the molecule.

setName

public void setName(java.lang.String name)

getFormula

public MolecularFormula getFormula()
Returns the molecular formula of the molecule.

Returns:
The molecular formula of the molecule.

getMass

public double getMass(Mass masstype)
Returns the mass of the molecule. The given masstype can be used to either retrieve the monoisotopic (most common isotopes) or the molecular (average of all the isotopes as they occur naturally) mass. The calculation of the mass is defered to MolecularFormula.getMass(Mass).

Parameters:
masstype - The mass type.
Returns:
The mass of the molecule.

setInChi

public void setInChi(java.lang.String inchi)
Sets the InChi string describing the molecular structure of the molecule. This string can be used to draw the structure.

Parameters:
inchi - The InChi string describing the structure of the molecule.

getInChi

public java.lang.String getInChi()
Returns the InChi string describing the molecular structure of the molecule. This string can be used to draw the structure.

Returns:
The InChi string describing the structure of the molecule.

setSmiles

public void setSmiles(java.lang.String smiles)
Sets the smiles string describing the molecular structure of the molecule. This string can be used to draw the structure.

Parameters:
smiles - The smiles string describing the structure of the molecule.

getSmiles

public java.lang.String getSmiles()
Returns the smiles string describing the molecular structure of the molecule. This string can be used to draw the structure.

Returns:
The smiles string describing the structure of the molecule.

setDescription

public void setDescription(java.lang.String description)
Optional description for the molecule. When this is not set a null-pointer is used to avoid too much memory consumption.

Parameters:
description - The description.

getDescription

public java.lang.String getDescription()
Returns the optional description for the molecule. When this is not set a null-pointer is used to avoid too much memory consumption.

Returns:
The description.

setSynonyms

public void setSynonyms(java.lang.String[] synonyms)
Adds the list of synonyms to the internal synonyms list. When a name is already present it is not added again.

Parameters:
synonyms - The list of synonyms to be added.

setSynonyms

public void setSynonyms(java.util.Collection<java.lang.String> synonyms)
Adds the list of synonyms to the internal synonyms list. When a name is already present it is not added again.

Parameters:
synonyms - The list of synonyms to be added.

getSynonyms

public java.util.Vector<java.lang.String> getSynonyms()
Returns the list of synonyms associated to this molecule.

Returns:
The list of synonyms.

setRetentionTime

public void setRetentionTime(double rt)
Sets the optional expected retention time for this molecule.

Parameters:
rt - The retention time.

getRetentionTime

public double getRetentionTime()
Returns the optional expected retention time for this molecule.

Returns:
The retention time.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object