Package org.helm.notation2.tools
Class MonomerParser
java.lang.Object
org.helm.notation2.tools.MonomerParser
public class MonomerParser extends Object
MonomerParser
- Author:
- hecht
-
Field Summary
Fields Modifier and Type Field Description static StringATTACHEMENT_ELEMENTstatic StringATTACHEMENT_ID_ELEMENTstatic StringATTACHEMENT_LABEL_ELEMENTstatic StringATTACHEMENTS_ELEMENTstatic StringATTACHEMENTS_LIST_ELEMENTstatic StringCAP_GROUP_NAME_ELEMENTstatic StringCAP_GROUP_SMILES_ELEMENTstatic StringMONOMER_ELEMENTstatic StringMONOMER_ID_ELEMENTstatic StringMONOMER_MOL_FILE_ELEMENTstatic StringMONOMER_NAME_ELEMENTstatic StringMONOMER_SMILES_ELEMENTstatic StringMONOMER_TYPE_ELEMENTstatic StringNATURAL_ANALOG_ELEMENTstatic StringPOLYMER_TYPE_ELEMENTprotected static StringSMILES_EXTENSION_SEPARATOR_REGEX -
Constructor Summary
Constructors Constructor Description MonomerParser() -
Method Summary
Modifier and Type Method Description static voidfillAttachmentInfo(Attachment att)static org.jdom2.ElementgetAttachementElement(Attachment att)This method converts Attachment to ATTACHMENT XML elementstatic AttachmentgetAttachment(org.jdom2.Element attachment)Convert ATTACHMENT element to Attachment objectstatic MonomergetMonomer(String monomerXMLString)static MonomergetMonomer(org.jdom2.Element monomer)Convert monomer element to Monomer objectstatic org.jdom2.ElementgetMonomerElement(Monomer monomer)This method converts Monomer to MONOMER XML elementstatic List<Monomer>getMonomerList(String monomerXMLString)static booleanvalidateAttachement(Attachment attachment)This method validates Attachment by the following rules Attachment must have unique ID cap group SMILES must be valid cap group SMILES must contain one R group R group in SMILES must match R group labelstatic voidvalidateAttachmentLabel(String label)This method checks if attachment label is in the format of R#, where # is a numberstatic booleanvalidateMonomer(Monomer monomer)This methods checks the validity of the monomer based on the following rules monomer cannot be null polymer type cannot be null and must be one of the defined polymer type monomer type cannot be null and must be one of the defined monomer type for a given polymer type Monomer ID cannot be null structure cannot be null for non-chemical type monomer structure SMILES must be valid attachment labels on monomer must be unique Attachment number on SMILES must match attachment List size Each attachment in attachment list must be valid (call validateAttachment()) Attachment labels on monomer must match atachment label on attachment list For non-chemical type monomers, modified monomer (ID length greater than 1) must have natural analog All monomers must have at least one attachment
-
Field Details
-
MONOMER_ELEMENT
- See Also:
- Constant Field Values
-
MONOMER_ID_ELEMENT
- See Also:
- Constant Field Values
-
MONOMER_SMILES_ELEMENT
- See Also:
- Constant Field Values
-
MONOMER_MOL_FILE_ELEMENT
- See Also:
- Constant Field Values
-
MONOMER_TYPE_ELEMENT
- See Also:
- Constant Field Values
-
POLYMER_TYPE_ELEMENT
- See Also:
- Constant Field Values
-
NATURAL_ANALOG_ELEMENT
- See Also:
- Constant Field Values
-
MONOMER_NAME_ELEMENT
- See Also:
- Constant Field Values
-
ATTACHEMENTS_LIST_ELEMENT
- See Also:
- Constant Field Values
-
ATTACHEMENTS_ELEMENT
- See Also:
- Constant Field Values
-
ATTACHEMENT_ELEMENT
- See Also:
- Constant Field Values
-
ATTACHEMENT_ID_ELEMENT
- See Also:
- Constant Field Values
-
ATTACHEMENT_LABEL_ELEMENT
- See Also:
- Constant Field Values
-
CAP_GROUP_NAME_ELEMENT
- See Also:
- Constant Field Values
-
CAP_GROUP_SMILES_ELEMENT
- See Also:
- Constant Field Values
-
SMILES_EXTENSION_SEPARATOR_REGEX
- See Also:
- Constant Field Values
-
-
Constructor Details
-
MonomerParser
public MonomerParser()
-
-
Method Details
-
getAttachment
Convert ATTACHMENT element to Attachment object- Parameters:
attachment- element- Returns:
- Attachment
-
getAttachementElement
This method converts Attachment to ATTACHMENT XML element- Parameters:
att- -- Attachment- Returns:
- Element
-
validateAttachement
public static boolean validateAttachement(Attachment attachment) throws MonomerException, IOException, ChemistryExceptionThis method validates Attachment by the following rules Attachment must have unique ID cap group SMILES must be valid cap group SMILES must contain one R group R group in SMILES must match R group label- Parameters:
attachment- given attachment- Returns:
- true or false
- Throws:
MonomerException- if attachment is not validIOException- IO errorChemistryException- if chemistry engine can not be initialized
-
getMonomer
Convert monomer element to Monomer object- Parameters:
monomer- element- Returns:
- Monomer
- Throws:
MonomerException- if element is not a valid monomer
-
getMonomerElement
This method converts Monomer to MONOMER XML element- Parameters:
monomer- given monomer- Returns:
- Element
- Throws:
MonomerException- if monomer is not valid
-
getMonomerList
public static List<Monomer> getMonomerList(String monomerXMLString) throws org.jdom2.JDOMException, IOException, MonomerException, org.helm.chemtoolkit.CTKException, ChemistryException- Throws:
org.jdom2.JDOMExceptionIOExceptionMonomerExceptionorg.helm.chemtoolkit.CTKExceptionChemistryException
-
getMonomer
public static Monomer getMonomer(String monomerXMLString) throws org.jdom2.JDOMException, IOException, MonomerException- Throws:
org.jdom2.JDOMExceptionIOExceptionMonomerException
-
validateMonomer
public static boolean validateMonomer(Monomer monomer) throws MonomerException, IOException, org.helm.chemtoolkit.CTKException, ChemistryExceptionThis methods checks the validity of the monomer based on the following rules monomer cannot be null polymer type cannot be null and must be one of the defined polymer type monomer type cannot be null and must be one of the defined monomer type for a given polymer type Monomer ID cannot be null structure cannot be null for non-chemical type monomer structure SMILES must be valid attachment labels on monomer must be unique Attachment number on SMILES must match attachment List size Each attachment in attachment list must be valid (call validateAttachment()) Attachment labels on monomer must match atachment label on attachment list For non-chemical type monomers, modified monomer (ID length greater than 1) must have natural analog All monomers must have at least one attachment- Parameters:
monomer- given monomer- Returns:
- true or false
- Throws:
MonomerException- if monomer is not validIOException- IO errororg.helm.chemtoolkit.CTKException- general ChemToolKit exception passed to HELMToolKitChemistryException- if chemistry engine can not be initialized
-
validateAttachmentLabel
This method checks if attachment label is in the format of R#, where # is a number- Parameters:
label- attachment label- Throws:
MonomerException- if label is not valid
-
fillAttachmentInfo
public static void fillAttachmentInfo(Attachment att) throws MonomerException, IOException, org.jdom2.JDOMException, ChemistryException, org.helm.chemtoolkit.CTKException- Throws:
MonomerExceptionIOExceptionorg.jdom2.JDOMExceptionChemistryExceptionorg.helm.chemtoolkit.CTKException
-