Class StripSaltsAction

java.lang.Object
chemaxon.standardizer.AbstractStandardizerAction
chemaxon.standardizer.advancedactions.StripSaltsAction
All Implemented Interfaces:
chemaxon.license.Licensable, StandardizerAction, PropertyChangeListener, Cloneable, EventListener

@PublicApi public class StripSaltsAction extends AbstractStandardizerAction
Strip salts standardizer action

Additional salts can be added in action string. Example configuration: "stripsalts:na='[Na+]':soo='[#8]S([#8])(=O)=O'"

Since:
6.0
  • Field Details

    • SALT_LIST_KEY

      public static final String SALT_LIST_KEY
      Property key for salt list modification
      See Also:
    • USE_DEFAULT_SALTS_KEY

      public static final String USE_DEFAULT_SALTS_KEY
      Property key for use default salts modification
      See Also:
    • DONT_REMOVE_LAST_COMPONENT_KEY

      public static final String DONT_REMOVE_LAST_COMPONENT_KEY
      Property key for "Don't Remove Last Component" option
      See Also:
    • DEFAULT_SALT_DICTIONARY_PATH

      public static final String DEFAULT_SALT_DICTIONARY_PATH
      Default salt dictionary file path.
      See Also:
    • SALT_ID_PROPERTY

      public static final String SALT_ID_PROPERTY
      Property key for salt ID
      See Also:
  • Constructor Details

    • StripSaltsAction

      public StripSaltsAction(Map<String,String> params)
      Initializes strip salts action
      Parameters:
      params - the parameters of the action
  • Method Details

    • isUseDefaultSalts

      public boolean isUseDefaultSalts()
      Gets whether default salt dictionary should be used
      Returns:
      whether default salt dictionary should be used
    • setUseDefaultSalts

      public void setUseDefaultSalts(boolean useDefaultSalts)
      Sets whether default salt dictionary should be used
      Parameters:
      useDefaultSalts - whether default salt dictionary should be used
    • addSalt

      public void addSalt(String saltID, Molecule molecule)
      Adds a salt to the salt list of the action
      Parameters:
      saltID - saltID of the salt
      molecule - the molecule of the salt
    • setSaltID

      public void setSaltID(int index, String saltID)
      Sets the name of the salt at the provided index
      Parameters:
      index - the target index
      saltID - the saltID to be set
    • isDontRemoveLastComponent

      public boolean isDontRemoveLastComponent()
    • setDontRemoveLastComponent

      public void setDontRemoveLastComponent(boolean dontRemoveLastComponent)
    • setMolecule

      public void setMolecule(int index, Molecule molecule)
      Sets the molecule of the salt at the provided index
      Parameters:
      index - the target index
      molecule - the molecule to be set
    • getSaltCount

      public int getSaltCount()
      Gets the count of the salts of the action
      Returns:
      the count of the salts of the action
    • getMolecule

      public Molecule getMolecule(int index)
      Gets the molecule at the provided index
      Parameters:
      index - the required index
      Returns:
      the molecule at the provided index
    • getSaltID

      public String getSaltID(int index)
      Gets the salt ID at the provided index
      Parameters:
      index - the required index
      Returns:
      the salt ID at the provided index
    • removeSalt

      public void removeSalt(int index)
      Removes a salt from the salt list of the action
      Parameters:
      index - index of the salt to be removed
    • removeSalts

      public void removeSalts(int... indexes)
      Removes a salt from the salt list of the action
      Parameters:
      indexes - indexes of the salts to be removed
    • removeAllSalts

      public void removeAllSalts()
      Removes all salts from the salt list of the action.
    • standardize1

      protected Changes standardize1(Molecule molecule) throws IllegalArgumentException
      Description copied from class: AbstractStandardizerAction
      This method contains the current standardization mechanism. Descendants needs to implement this method.
      Special molecules containing more components (e.g. RgMolecule, RxnMolecule) are decomponented by the method AbstractStandardizerAction.getComponents(Molecule), and AbstractStandardizerAction.standardize1(Molecule) method is called on each component, before applied on the original molecule. If a descendant does not want this to occur, this method must be overridden.
      Logs of standardization should be generated to a Logger, that can be collected by using StandardizerLogger.getLogger() method.
      Specified by:
      standardize1 in class AbstractStandardizerAction
      Parameters:
      molecule - the Molecule instance to be standardized
      Returns:
      the changes applied on the molecule during the standardization process
      Throws:
      IllegalArgumentException - if the provided molecule or the provided parameters of the action are invalid
    • readSaltDictionary

      public static List<Molecule> readSaltDictionary()
      Reads the default salt dictionary. The name of the salt will be the name of the molecule
      Returns:
      the default salt dictionary
    • getSaltList

      public List<Molecule> getSaltList()
      Gets the custom salt list of the action
      Returns:
      the custom salt list of the action
    • clone

      Overrides:
      clone in class AbstractStandardizerAction
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Overrides:
      toString in class AbstractStandardizerAction
    • getComponents

      protected List<Molecule> getComponents(Molecule molecule)
      Description copied from class: AbstractStandardizerAction
      A recursive algorithm getting all components (reactants, agents and products of reaction molecules, R-group definitions of Rg-Molecules) of the molecule. Used to collect all. If components must not be standardized, this method should be overridden.
      Overrides:
      getComponents in class AbstractStandardizerAction
      Parameters:
      molecule - the target molecule
      Returns:
      the resulted list of components