SigPath

org.sigpath.adapter
Class ReactionAdapterImpl

java.lang.Object
  extended by org.sigpath.adapter.ReactionAdapterImpl
All Implemented Interfaces:
ReactionAdapter

public class ReactionAdapterImpl
extends Object
implements ReactionAdapter

Adapter class for creating a new Reaction and storing it to the database.

Version:
1.0
Author:
Manda Wilson
See Also:
Reaction

Constructor Summary
ReactionAdapterImpl(SigPathEntity spe, SPDBManager spdbm, ValidationErrors ve, String substrateSpid, String productSpid)
          substrateSpid and productSpid can be null
ReactionAdapterImpl(String spid, SPDBManager spdbm, ValidationErrors ve)
           
ReactionAdapterImpl(ValidationErrors ve)
          Deprecated. Use the DBTask framework instead. Adapters will be dropped form SigPath in the near future.
 
Method Summary
 void addComplextoRight(String name, String[] spids, boolean isSubstrate, boolean isProduct)
          Add a new complex to the right-hand side of the reaction.
 void addInteractionSite(String spid, String sites)
          Adds the interaction sites for the BioPolymer specified via a unique SPID.
 void addLiteratureReference(String pubMedID)
          Add a new PubMed ID.
 void addLiteratureReferenceNote(String _publicationNote)
          Add a new Publication Note.
 void addModifiedChemicalToRight(String spid, String name, String type, boolean isSubstrate, boolean isProduct)
          Add a new modified chemical to the right-hand side of the reaction.
 void addMoleculeToLeft(String spid, String sites, boolean isSubstrate, boolean isProduct)
          Add a new chemical to the left-hand side of the reaction.
 void addMoleculeToRight(String spid, String sites, boolean isSubstrate, boolean isProduct)
          Add a new chemical to the right-hand side of the reaction.
 void close()
          Use this to close the adapter and free resources.
 Date getDateLastModified()
           
 Date getDateSubmitted()
           
 String getDescription()
           
 String getInteractionSite(String spid)
          Gets the interaction site for the BioPolymer specified via a unique SPID.
 Parameter getKBackward()
          Get the backward rate of the reaction.
 Parameter getKForward()
          Get the forward rate of the reaction.
 LiteratureReferences getLiteratureReferences()
          Get collection of literature references.
 Collection getMoleculesOnLeft()
          Returns a Collection of MoleculeDisplay objects.
 Collection getMoleculesOnRight()
          Returns a Collection of MoleculeDisplay objects.
 Reaction getReaction()
          Returns the reaction.
 Reaction getReaction(EntityManager em)
          Temporary method to for FO9 testing Returns the reaction.
 String getSpid()
          Returns the reaction spid.
 String getUser()
          Gets User
 void removeAllLiteratureReferences()
          Removes all LiteratureReferences from Reaction.
 void removeInteractionSite(String spid)
          Removes the interaction site for the BioPolymer specified via a unique SPID.
 void removeKBackward()
          Remove the backward rate of the reaction.
 void removeKForward()
          Remove the forward rate of the reaction.
 void removeMoleculeFromLeft(String spid)
          Remove the chemical specified by the SPID from the left-hand side of the reaction.
 void removeMoleculeFromRight(String spid)
          Remove the chemical specified by the SPID from the right-hand side of the reaction.
 boolean saveReaction()
          Saves the reaction to the database.
 void setDbManager(SPDBManager dbm)
          Set the database manager to use for this adapter.
 void setDescription(String description)
           
 void setKBackward(double value, String unit)
          Set the backward rate of the reaction.
 void setKForward(double value, String unit)
          Set the forward rate of the reaction.
 void setUser(String user_name)
          Sets User
 void updateReaction()
          Updates the reaction in the database.
 ValidationErrors validate()
          Validate the reaction against all known scientific rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReactionAdapterImpl

public ReactionAdapterImpl(ValidationErrors ve)
Deprecated. Use the DBTask framework instead. Adapters will be dropped form SigPath in the near future.

Constructor initializes database manager and reaction. If a database error occurs an error is generated. The errors may be retrieved with the validate method.

See Also:
SPDBManager, Internal Transaction***

ReactionAdapterImpl

public ReactionAdapterImpl(String spid,
                           SPDBManager spdbm,
                           ValidationErrors ve)
                    throws SigPathDatabaseException
Throws:
SigPathDatabaseException

ReactionAdapterImpl

public ReactionAdapterImpl(SigPathEntity spe,
                           SPDBManager spdbm,
                           ValidationErrors ve,
                           String substrateSpid,
                           String productSpid)
substrateSpid and productSpid can be null

Method Detail

setDbManager

public void setDbManager(SPDBManager dbm)
Description copied from interface: ReactionAdapter
Set the database manager to use for this adapter.

Specified by:
setDbManager in interface ReactionAdapter
Parameters:
dbm - Database manager to use for this adapter.

close

public void close()
Use this to close the adapter and free resources.


addMoleculeToLeft

public void addMoleculeToLeft(String spid,
                              String sites,
                              boolean isSubstrate,
                              boolean isProduct)
Add a new chemical to the left-hand side of the reaction. Chemicals are specified via a unique SPID.

Specified by:
addMoleculeToLeft in interface ReactionAdapter
Parameters:
spid - spid of chemical
sites - interaction sites of chemical
isSubstrate - indicates if the molecule is a substrate
isProduct - indicates if the molecule is a product
See Also:
Chemical, ResidueRange, InteractionSites

removeMoleculeFromLeft

public void removeMoleculeFromLeft(String spid)
Remove the chemical specified by the SPID from the left-hand side of the reaction. If the spid has not been added to this side of the reaction an error is created. The errors may be retrieved with the validate method.

Specified by:
removeMoleculeFromLeft in interface ReactionAdapter
Parameters:
spid - spid of chemical
See Also:
Chemical

getMoleculesOnLeft

public Collection getMoleculesOnLeft()
Returns a Collection of MoleculeDisplay objects. There is one MoleculeDisplay object for each Chemical on the left-hand side of the reaction.

Specified by:
getMoleculesOnLeft in interface ReactionAdapter
Returns:
Collection of MoleculeDisplay objects
See Also:
MoleculeDisplay, Chemical

addMoleculeToRight

public void addMoleculeToRight(String spid,
                               String sites,
                               boolean isSubstrate,
                               boolean isProduct)
Add a new chemical to the right-hand side of the reaction. Chemicals are specified via a unique SPID.

Specified by:
addMoleculeToRight in interface ReactionAdapter
Parameters:
spid - spid of chemical
sites - interaction sites of chemical
isSubstrate - indicates if the molecule is a substrate
isProduct - indicates if the molecule is a product
See Also:
Chemical, ResidueRange, InteractionSites

removeMoleculeFromRight

public void removeMoleculeFromRight(String spid)
Remove the chemical specified by the SPID from the right-hand side of the reaction. If the spid has not been added to this side of the reaction an error is created. The errors may be retrieved with the validate method.

Specified by:
removeMoleculeFromRight in interface ReactionAdapter
Parameters:
spid - spid of chemical
See Also:
Chemical

getMoleculesOnRight

public Collection getMoleculesOnRight()
Returns a Collection of MoleculeDisplay objects. There is one MoleculeDisplay object for each Chemical on the right-hand side of the reaction.

Specified by:
getMoleculesOnRight in interface ReactionAdapter
Returns:
Collection of MoleculeDisplay objects
See Also:
MoleculeDisplay, Chemical

addComplextoRight

public void addComplextoRight(String name,
                              String[] spids,
                              boolean isSubstrate,
                              boolean isProduct)
Add a new complex to the right-hand side of the reaction. The complex is made up of the set of molecules specified by the given spids. If there is a database error an error is created. An error is created if a spid does not exist in the database or if the spid does not belong to a Chemical. The errors may be retrieved with the validate method.

Specified by:
addComplextoRight in interface ReactionAdapter
Parameters:
name - name of complex
spids - spids of molecules in complex
isSubstrate - indicates if the molecule is a substrate
isProduct - indicates if the molecule is a product
See Also:
Complex, Internal Transaction***

addModifiedChemicalToRight

public void addModifiedChemicalToRight(String spid,
                                       String name,
                                       String type,
                                       boolean isSubstrate,
                                       boolean isProduct)
Add a new modified chemical to the right-hand side of the reaction. Types of modified chemicals are given in SigPathConstants. If the source SPID does not exist in the database an error is created. If there is a database error an error is created. The errors may be retrieved with the validate method.

Specified by:
addModifiedChemicalToRight in interface ReactionAdapter
Parameters:
spid - spid of source chemical
name - name of modified chemical
type - type of modified chemical
isSubstrate - indicates if the molecule is a substrate
isProduct - indicates if the molecule is a product
See Also:
Chemical, Internal Transaction***

setKForward

public void setKForward(double value,
                        String unit)
Set the forward rate of the reaction.

Specified by:
setKForward in interface ReactionAdapter
Parameters:
value - forward rate of reaction
unit - unit of rate

getKForward

public Parameter getKForward()
Get the forward rate of the reaction.

Specified by:
getKForward in interface ReactionAdapter
Returns:
Parameter

removeKForward

public void removeKForward()
Remove the forward rate of the reaction.

Specified by:
removeKForward in interface ReactionAdapter

setKBackward

public void setKBackward(double value,
                         String unit)
Set the backward rate of the reaction.

Specified by:
setKBackward in interface ReactionAdapter
Parameters:
value - backward rate of reaction
unit - unit of rate

getKBackward

public Parameter getKBackward()
Get the backward rate of the reaction.

Specified by:
getKBackward in interface ReactionAdapter
Returns:
Parameter

removeKBackward

public void removeKBackward()
Remove the backward rate of the reaction.

Specified by:
removeKBackward in interface ReactionAdapter

addLiteratureReference

public void addLiteratureReference(String pubMedID)
Add a new PubMed ID.

Specified by:
addLiteratureReference in interface ReactionAdapter
Parameters:
pubMedID - PubMed ID

addLiteratureReferenceNote

public void addLiteratureReferenceNote(String _publicationNote)
Add a new Publication Note.

Specified by:
addLiteratureReferenceNote in interface ReactionAdapter
Parameters:
_publicationNote - publication note

removeAllLiteratureReferences

public void removeAllLiteratureReferences()
Removes all LiteratureReferences from Reaction.

Specified by:
removeAllLiteratureReferences in interface ReactionAdapter

getLiteratureReferences

public LiteratureReferences getLiteratureReferences()
Get collection of literature references.

Specified by:
getLiteratureReferences in interface ReactionAdapter
Returns:
LiteratureReferences
See Also:
LiteratureReferences

setUser

public void setUser(String user_name)
Description copied from interface: ReactionAdapter
Sets User

Specified by:
setUser in interface ReactionAdapter

getUser

public String getUser()
Description copied from interface: ReactionAdapter
Gets User

Specified by:
getUser in interface ReactionAdapter

getDateSubmitted

public Date getDateSubmitted()
Specified by:
getDateSubmitted in interface ReactionAdapter

getDateLastModified

public Date getDateLastModified()
Specified by:
getDateLastModified in interface ReactionAdapter

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface ReactionAdapter

getDescription

public String getDescription()
Specified by:
getDescription in interface ReactionAdapter

saveReaction

public boolean saveReaction()
Saves the reaction to the database. If a database error occurs an error is created. The errors may be retrieved with the validate method.

Specified by:
saveReaction in interface ReactionAdapter

updateReaction

public void updateReaction()
Updates the reaction in the database. This only updates parameters and pubmed ids. If a database error occurs an error is created. The errors may be retrieved with the validate method.

Specified by:
updateReaction in interface ReactionAdapter

validate

public ValidationErrors validate()
Validate the reaction against all known scientific rules.

Specified by:
validate in interface ReactionAdapter
Returns:
ValidationErrors
See Also:
ValidationErrors

getSpid

public String getSpid()
Returns the reaction spid. Returns null if the reaction has not been created (& saved) yet.

Specified by:
getSpid in interface ReactionAdapter
Returns:
String spid
See Also:
Reaction

getReaction

public Reaction getReaction(EntityManager em)
                     throws SigPathDatabaseException
Temporary method to for FO9 testing Returns the reaction.

Returns:
Reaction
Throws:
SigPathDatabaseException
See Also:
Reaction

getReaction

public Reaction getReaction()
                     throws SigPathDatabaseException
Returns the reaction.

Returns:
Reaction
Throws:
SigPathDatabaseException
See Also:
Reaction

getInteractionSite

public String getInteractionSite(String spid)
Gets the interaction site for the BioPolymer specified via a unique SPID. If there is no interaction site for the BioPolymer an empty string is returned.

Specified by:
getInteractionSite in interface ReactionAdapter
Parameters:
spid - spid of chemical
Returns:
String residue range for the Chemical
See Also:
BioPolymer, ResidueRange, InteractionSites

removeInteractionSite

public void removeInteractionSite(String spid)
Removes the interaction site for the BioPolymer specified via a unique SPID.

Specified by:
removeInteractionSite in interface ReactionAdapter
Parameters:
spid - spid of chemical
See Also:
BioPolymer, ResidueRange, InteractionSites

addInteractionSite

public void addInteractionSite(String spid,
                               String sites)
Adds the interaction sites for the BioPolymer specified via a unique SPID.

Specified by:
addInteractionSite in interface ReactionAdapter
Parameters:
spid - spid of chemical
sites - interaction sites of chemical
See Also:
BioPolymer, ResidueRange, InteractionSites

SigPath

Copyright © 2002-2005 Institute for Computational Biomedicine, All Rights Reserved.