SigPath

org.sigpath.task.xml
Class TExportBase

java.lang.Object
  extended by org.sigpath.task.DBTask
      extended by org.sigpath.task.xml.TExportBase
All Implemented Interfaces:
Task
Direct Known Subclasses:
TExportChangeLog, TExportComplex, TExportComponents, TExportConcentrationMeasurement, TExportEnzymaticReaction, TExportKinetic, TExportKineticCustom, TExportLiteratureReference, TExportLiteratureReferences, TExportModel, TExportModels, TExportModifiedChemical, TExportNamedChemical, TExportNamedChemicalInteraction, TExportOrganism, TExportPathway, TExportPendingList, TExportPendingReviews, TExportProtein, TExportReaction, TExportReferences, TExportSmallMolecule, TExportStandaloneModel, TExportUserComment

public abstract class TExportBase
extends DBTask

Base Class for Exporting SigPath Entities to XML.

Author:
Ethan Cerami, Fabien Campagne

Field Summary
protected  DataSource dataSource
           
protected  HashMap idMap
          map spid -> castor object.
protected  List idRefActions
          list of idref actions.
protected  SigpathSubmission root
           
protected  boolean standaloneOutput
           
 
Fields inherited from class org.sigpath.task.DBTask
dbManager, embeddedTask, entityManager, errors, ftsm, progressListener, sigpathFactory, unitManager, userManager, xdebug
 
Constructor Summary
  TExportBase(DataSource dataSource, SigpathSubmission root, HashMap spidsToTempIDs)
          Creates an exporter that gets data to export from a DataSource.
  TExportBase(DataSource dataSource, SigpathSubmission root, HashMap spidsToTempIDs, List idRefActions)
          Creates an exporter that gets data to export from a DataSource.
protected TExportBase(SigpathSubmission root, HashMap spidsToTempIDs)
           
protected TExportBase(SigpathSubmission root, HashMap spidsToTempIDs, List idRefActions)
           
 
Method Summary
protected  Change_log addChangeLog(SigPathEntity spe)
          Adds Change Log Information to XML Document.
protected  Reviews addReviews(SigPathEntity spe)
          Adds Review Information to XML Document.
protected  void addStandalone(Model spModel)
          adds a standalone model to the submission (assumes the submission is standalone)
protected  String clearEmptyField(String description)
           
 Molecule[] componentsToMolecules(SigPathEntity entity)
          Converts the components of a complex into XLM molecules.
protected  String constructReactionSummary(Interaction interaction)
           
protected  InteractionRef createInteractionReference(Interaction interaction)
          Return an XML interaction-ref element.
 Molecule createMolecule(Chemical sp_chem, HashMap spidsToTempIDs, SigpathSubmission root)
          Creates a Castor molecule object given a SigPath chemical.
static ExternalReference findUniqueAcDb(ExternalReferences refs, EntityManager em)
          Find a pair of accession code/database that uniquely identifies this molecule in the current database.
protected  String getACDB(Chemical chemical)
          Returns a valid ACDB for a Chemical object.
 String getCreatedBy(PendingList jdoInstance)
           
 CustomKinetic getCustomKinetic(Kinetic kinetic)
          Gets the kinetic custom when the parameter is of class (KineticCustom).
 DataSource getDataSource()
           
protected  EnzymaticParameters getEnzymaticReactionParameters(EnzymaticReaction spEnzymaticReaction)
           
protected  Enzyme getEnzyme(EnzymaticReaction jdoInstance)
           
 ExcludedReactions getExcludedReactions(Model spModel)
           
protected  Formula getFormula(KineticCustom kinetic)
           
protected  HashMap getIdMap()
          Gets HashMap.
protected  KineticBindings getKineticBindings(KineticInteraction kInt)
           
protected  KineticRef getKineticRef(KineticInteraction reaction)
           
 ModelCompartments getModelCompartments(Model spModel)
           
 NamedChemicalRef[] getNamedChemicalRef(NamedChemicalInteraction jdoInstance)
           
protected  ParametersBindingsDeclaration getParametersBindingsDeclaration(KineticCustom kinetic)
           
protected  PreviousVersion getPreviousVersion(Model spModel)
          Get Prevoius Version from Model.
 Left getReactionLeftSide(Collection left)
           
 Modifiers getReactionMidleSide(Collection modifiers)
           
protected  Parameters getReactionParameters(Reaction reaction)
           
 Right getReactionRightSide(Collection right)
           
protected  SpeciesBindingsDeclaration getSpeciesBindingsDeclaration(KineticCustom kinetic)
           
protected  TargetUnit getTargetUnit(Model spModel)
           
 boolean isStandaloneOutput()
          Deprecated. Use TExportStandaloneModel instead
protected  void postProcessConcentrationMeasurement(ConcentrationMeasurement spCM, Concentration_measurement cm)
           
protected  void postProcessEnzymaticReaction(EnzymaticReaction enzymaticReaction, EnzymaticReaction castorInstance)
           
protected  void postProcessModel(Model spModel, Model model)
           
 void postProcessPendingList(PendingList jdoInstance, Pending_list castorInstance)
           
protected  void postProcessReaction(Reaction jdoInstance, Reaction castorInstance)
           
protected  void processChemicals(Collection molecs, StringBuffer text)
          get short names for chemicals and builds a reaction's description while doing this
protected  void setDataSource(DataSource source)
           
protected  void setProcessingUnit(String spid)
           
static boolean setSpid(Chemical sp_chem, Molecule mol)
          Sets a spid attribute on the molecule only if the chemical does not refers to background information, and if no idref is provided for the molecule.
 void setStandaloneOutput(boolean standaloneOutput)
          Deprecated. Use TExportStandaloneModel instead
 
Methods inherited from class org.sigpath.task.DBTask
_execute, close, delete, execute, getDbManager, getErrors, isEmbeddedTask, isTaskThrewException, reindex, resolve, setDbManager, setEmbeddedTask, setEmbeddedTask, setObtainTransactionsFrom, setProgressListener, setTaskThrewException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idMap

protected HashMap idMap
map spid -> castor object.


root

protected SigpathSubmission root

standaloneOutput

protected boolean standaloneOutput

dataSource

protected DataSource dataSource

idRefActions

protected List idRefActions
list of idref actions.

Constructor Detail

TExportBase

protected TExportBase(SigpathSubmission root,
                      HashMap spidsToTempIDs)

TExportBase

public TExportBase(DataSource dataSource,
                   SigpathSubmission root,
                   HashMap spidsToTempIDs)
Creates an exporter that gets data to export from a DataSource.

Parameters:
root - Castor SigpathSubmission object
spidsToTempIDs - map of spids to temporary ids

TExportBase

protected TExportBase(SigpathSubmission root,
                      HashMap spidsToTempIDs,
                      List idRefActions)

TExportBase

public TExportBase(DataSource dataSource,
                   SigpathSubmission root,
                   HashMap spidsToTempIDs,
                   List idRefActions)
Creates an exporter that gets data to export from a DataSource.

Parameters:
root - Castor SigpathSubmission object
spidsToTempIDs - map of spids to temporary ids
Method Detail

getDataSource

public DataSource getDataSource()

setDataSource

protected void setDataSource(DataSource source)

getIdMap

protected HashMap getIdMap()
Gets HashMap.

Returns:
Hashmap of SPIDs to TempIDs

isStandaloneOutput

public boolean isStandaloneOutput()
Deprecated. Use TExportStandaloneModel instead

Should this model be exported standalone?

Returns:
True if the model should be exported so that it can be reimported in a fresh database.

setStandaloneOutput

public void setStandaloneOutput(boolean standaloneOutput)
Deprecated. Use TExportStandaloneModel instead

Decide if the output should be standalone. Standalone outputs will contain all the information needed to reconstruct a model in a fresh database. In practice, when standalone output is set to true, the XML output will include molecules even if they are background information. The model will also include reactions and nzymatic reactions that it references. Standalone outputs are useful to generate standalone XML submissions for models. This comes handy when building regression tests for model export.

Parameters:
standaloneOutput - true to generate standalone output. false (default) otherwise.

addChangeLog

protected Change_log addChangeLog(SigPathEntity spe)
Adds Change Log Information to XML Document.


addReviews

protected Reviews addReviews(SigPathEntity spe)
Adds Review Information to XML Document.


addStandalone

protected void addStandalone(Model spModel)
adds a standalone model to the submission (assumes the submission is standalone)

Parameters:
spModel -

clearEmptyField

protected String clearEmptyField(String description)

componentsToMolecules

public Molecule[] componentsToMolecules(SigPathEntity entity)
                                 throws SigPathDatabaseException
Converts the components of a complex into XLM molecules.

Parameters:
entity -
Returns:
Throws:
SigPathDatabaseException

createMolecule

public Molecule createMolecule(Chemical sp_chem,
                               HashMap spidsToTempIDs,
                               SigpathSubmission root)
Creates a Castor molecule object given a SigPath chemical. If the chemical has already been added to the submission then the molecule is created with an idRef to that castor chemical. If the chemical has not already been added and it is a complex or a modified chemical, then the Castor complex or modified chemical is created and the molecule has an idRef to that castor component. If the chemical has not already been added, and it is not a complex or a modified chemical then the molecule is created with the accession code/database pair and organism. SigPath tries to optimize which accession code/database pair to use, so that the pair identifies a single chemical in the current database. The current strategy is to look for accession codes from SwissProt, find the first one which uniquely identifies a chemical in the current database and return it. If no accession code for SwissProt is available, then the first accession code found is used.

Parameters:
sp_chem - Sigpath Chemical
spidsToTempIDs - HashMap that maps spids to idRefs
root - SigpathSubmission root
Returns:
org.sigpath.bioimport.reaction2.Molecule Castor molecule

findUniqueAcDb

public static ExternalReference findUniqueAcDb(ExternalReferences refs,
                                               EntityManager em)
                                        throws SigPathDatabaseException
Find a pair of accession code/database that uniquely identifies this molecule in the current database. If there are swiss-prot accession codes, use the one which finds only one molecule in the current source database otherwise, just take the first accession code.

Throws:
SigPathDatabaseException

setSpid

public static boolean setSpid(Chemical sp_chem,
                              Molecule mol)
Sets a spid attribute on the molecule only if the chemical does not refers to background information, and if no idref is provided for the molecule.

Parameters:
sp_chem - Chemical (source)
mol - molecule (destination).
Returns:
True if the spid attribute was set, false otherwise.

getCustomKinetic

public CustomKinetic getCustomKinetic(Kinetic kinetic)
Gets the kinetic custom when the parameter is of class (KineticCustom). The method uses the TExportKineticCustom export class

Parameters:
kinetic -
Returns:
CustomKinetic

getEnzymaticReactionParameters

protected EnzymaticParameters getEnzymaticReactionParameters(EnzymaticReaction spEnzymaticReaction)

getEnzyme

protected Enzyme getEnzyme(EnzymaticReaction jdoInstance)
                    throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getFormula

protected Formula getFormula(KineticCustom kinetic)
                      throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getKineticBindings

protected KineticBindings getKineticBindings(KineticInteraction kInt)
                                      throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getKineticRef

protected KineticRef getKineticRef(KineticInteraction reaction)
                            throws SigPathDatabaseException
Parameters:
reaction -
Returns:
Throws:
SigPathDatabaseException

getNamedChemicalRef

public NamedChemicalRef[] getNamedChemicalRef(NamedChemicalInteraction jdoInstance)
                                       throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getParametersBindingsDeclaration

protected ParametersBindingsDeclaration getParametersBindingsDeclaration(KineticCustom kinetic)
                                                                  throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getReactionLeftSide

public Left getReactionLeftSide(Collection left)
                         throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getReactionMidleSide

public Modifiers getReactionMidleSide(Collection modifiers)
                               throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getReactionParameters

protected Parameters getReactionParameters(Reaction reaction)

getReactionRightSide

public Right getReactionRightSide(Collection right)
                           throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getSpeciesBindingsDeclaration

protected SpeciesBindingsDeclaration getSpeciesBindingsDeclaration(KineticCustom kinetic)
                                                            throws SigPathDatabaseException
Throws:
SigPathDatabaseException

postProcessConcentrationMeasurement

protected void postProcessConcentrationMeasurement(ConcentrationMeasurement spCM,
                                                   Concentration_measurement cm)

getACDB

protected String getACDB(Chemical chemical)
Returns a valid ACDB for a Chemical object. Preference is given to the SWISSPROT database

Parameters:
chemical - The chemical to get the ACDB for
Returns:
A valid ACDB or null if none could be found

postProcessEnzymaticReaction

protected void postProcessEnzymaticReaction(EnzymaticReaction enzymaticReaction,
                                            EnzymaticReaction castorInstance)
                                     throws SigPathDatabaseException
Throws:
SigPathDatabaseException

postProcessReaction

protected void postProcessReaction(Reaction jdoInstance,
                                   Reaction castorInstance)
                            throws SigPathDatabaseException
Throws:
SigPathDatabaseException

setProcessingUnit

protected void setProcessingUnit(String spid)

createInteractionReference

protected InteractionRef createInteractionReference(Interaction interaction)
Return an XML interaction-ref element.

Parameters:
interaction - The interaction the reference will point to.
Returns:
InteractionRef

constructReactionSummary

protected String constructReactionSummary(Interaction interaction)
                                   throws SigPathDatabaseException
Throws:
SigPathDatabaseException

processChemicals

protected void processChemicals(Collection molecs,
                                StringBuffer text)
                         throws SigPathDatabaseException
get short names for chemicals and builds a reaction's description while doing this

Parameters:
molecs -
text -
Throws:
SigPathDatabaseException

getPreviousVersion

protected PreviousVersion getPreviousVersion(Model spModel)
Get Prevoius Version from Model.

Parameters:
spModel: - datamodel Model class
Returns:
org.sigpath.bioimport.reaction2.PreviousVersion

getTargetUnit

protected TargetUnit getTargetUnit(Model spModel)

getModelCompartments

public ModelCompartments getModelCompartments(Model spModel)

getExcludedReactions

public ExcludedReactions getExcludedReactions(Model spModel)

postProcessModel

protected void postProcessModel(Model spModel,
                                Model model)

getCreatedBy

public String getCreatedBy(PendingList jdoInstance)

postProcessPendingList

public void postProcessPendingList(PendingList jdoInstance,
                                   Pending_list castorInstance)

SigPath

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