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 actionAdditional salts can be added in action string. Example configuration:
"stripsalts:na='[Na+]':soo='[#8]S([#8])(=O)=O'"
- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SALT_DICTIONARY_PATH
Default salt dictionary file path.static String
DONT_REMOVE_LAST_COMPONENT_KEY
Property key for "Don't Remove Last Component" optionstatic String
SALT_ID_PROPERTY
Property key for salt IDstatic String
SALT_LIST_KEY
Property key for salt list modificationstatic String
USE_DEFAULT_SALTS_KEY
Property key for use default salts modification-
Fields inherited from class chemaxon.standardizer.AbstractStandardizerAction
CONFIG_PATH_KEY, FORMAT_KEY, ID_KEY, support
-
-
Constructor Summary
Constructors Constructor Description StripSaltsAction(Map<String,String> params)
Initializes strip salts action
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSalt(String saltID, Molecule molecule)
Adds a salt to the salt list of the actionStripSaltsAction
clone()
protected List<Molecule>
getComponents(Molecule molecule)
A recursive algorithm getting all components (reactants, agents and products of reaction molecules, R-group definitions of Rg-Molecules) of the molecule.Molecule
getMolecule(int index)
Gets the molecule at the provided indexint
getSaltCount()
Gets the count of the salts of the actionString
getSaltID(int index)
Gets the salt ID at the provided indexList<Molecule>
getSaltList()
Gets the custom salt list of the actionboolean
isDontRemoveLastComponent()
boolean
isUseDefaultSalts()
Gets whether default salt dictionary should be usedstatic List<Molecule>
readSaltDictionary()
Reads the default salt dictionary.void
removeAllSalts()
Removes all salts from the salt list of the action.void
removeSalt(int index)
Removes a salt from the salt list of the actionvoid
removeSalts(int... indexes)
Removes a salt from the salt list of the actionvoid
setDontRemoveLastComponent(boolean dontRemoveLastComponent)
void
setMolecule(int index, Molecule molecule)
Sets the molecule of the salt at the provided indexvoid
setSaltID(int index, String saltID)
Sets the name of the salt at the provided indexvoid
setUseDefaultSalts(boolean useDefaultSalts)
Sets whether default salt dictionary should be usedprotected Changes
standardize1(Molecule molecule)
This method contains the current standardization mechanism.String
toString()
-
Methods inherited from class chemaxon.standardizer.AbstractStandardizerAction
addPropertyChangeListener, addPropertyChangeListener, anyBooleanPropertyTrue, cloneItem, getDescriptor, getID, isActive, isAvailable, isLicensed, isValid, propertyChange, removePropertyChangeListener, removePropertyChangeListener, setActive, setID, setLicenseEnvironment, setValid, standardize
-
-
-
-
Field Detail
-
SALT_LIST_KEY
public static final String SALT_LIST_KEY
Property key for salt list modification- See Also:
- Constant Field Values
-
USE_DEFAULT_SALTS_KEY
public static final String USE_DEFAULT_SALTS_KEY
Property key for use default salts modification- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
DEFAULT_SALT_DICTIONARY_PATH
public static final String DEFAULT_SALT_DICTIONARY_PATH
Default salt dictionary file path.- See Also:
- Constant Field Values
-
SALT_ID_PROPERTY
public static final String SALT_ID_PROPERTY
Property key for salt ID- See Also:
- Constant Field Values
-
-
Method Detail
-
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 saltmolecule
- 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 indexsaltID
- 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 indexmolecule
- 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 methodAbstractStandardizerAction.getComponents(Molecule)
, andAbstractStandardizerAction.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 aLogger
, that can be collected by usingStandardizerLogger.getLogger()
method.- Specified by:
standardize1
in classAbstractStandardizerAction
- Parameters:
molecule
- theMolecule
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 final 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
public StripSaltsAction clone() throws CloneNotSupportedException
- Overrides:
clone
in classAbstractStandardizerAction
- Throws:
CloneNotSupportedException
-
toString
public String toString()
- Overrides:
toString
in classAbstractStandardizerAction
-
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 classAbstractStandardizerAction
- Parameters:
molecule
- the target molecule- Returns:
- the resulted list of components
-
-