Class ChemUtils


  • public final class ChemUtils
    extends java.lang.Object
    Utilities related to chemical classes. Currently support to search of the core when molecule search is executed. UI can color the molecule core using different color.
    Author:
    Petr Hamernik
    • Method Detail

      • genSearchType

        public static int genSearchType​(DFOperator op)
        Temporary method finding appropriate JChemSearch search type constant for the given operator.
        Parameters:
        op - Operator must be a structure operator
        Returns:
        The one of JChemSearch search type constant
      • toStructureOperator

        public static DFOperator toStructureOperator​(int jchemSearchType)
        Converts JChemSearch search type to structure DFOperator. It is an inverse method to genSearchType.
        Parameters:
        jchemSearchType - JChemSearch search type constant
        Returns:
        structure DFOperator
      • convertToSmilesRepresentation

        public static java.lang.String convertToSmilesRepresentation​(chemaxon.struc.Molecule m)
        Generates the simplest smiles representation of the molecule. It tries in this order: Daylight smiles, Chemaxon Extended smiles, Daylight smarts, Chemaxon Extended smarts.
        Parameters:
        m - The molecule
        Returns:
        The first smiles variant that is supported
        Throws:
        java.lang.IllegalArgumentException - If none of the smiles variants are supported. Your code should expect this to happen on occasion.
      • convertToSmartsRepresentation

        public static java.lang.String convertToSmartsRepresentation​(chemaxon.struc.Molecule m)
        Generates the simplest smarts representation of the molecule. It tries in this order: Daylight smarts, Chemaxon Extended smarts.
        Parameters:
        m - The molecule
        Returns:
        The first smarts variant that is supported
        Throws:
        java.lang.IllegalArgumentException - If none of the smiles variants are supported. Your code should expect this to happen on occasion.
      • convertToStringRepresentation

        public static java.lang.String convertToStringRepresentation​(chemaxon.struc.Molecule m)
        Generates the simplest smiles representation of the molecule. It tries in this order: Daylight smiles, Chemaxon Extended smiles, Daylight smarts, Chemaxon Extended smarts.
        Parameters:
        m - The molecule
        Returns:
        The first smiles variant that is supported
        Throws:
        java.lang.IllegalArgumentException - If none of the smiles variants are supported. Your code should expect this to happen on occasion.
      • convertToStringRepresentation

        public static java.lang.String convertToStringRepresentation​(chemaxon.struc.Molecule m,
                                                                     java.lang.String... formats)
        Converts given molecule into a format. Tries format by format in given order.
        Parameters:
        m - the molecule
        formats - export formats like "smiles", "smarts", "mrv", ...
        Returns:
        the first succesfull result
        Throws:
        java.lang.IllegalArgumentException - if none of the given format is supported. Your code should expect this to happen on occasion.
        Since:
        18.15.0
      • getStructureField

        public static com.google.common.base.Optional<DFField> getStructureField​(DFEntity entity)
        Parameters:
        entity - JChemBase entity
        Returns:
        structure field
      • getStandardizer

        public static chemaxon.standardizer.Standardizer getStandardizer​(DFEntity entity)
        Gets standardizer from entity based on JChemEntityCapability.
        Parameters:
        entity - structure entity
        Returns:
        standardizer or null if entity doesn't have JChemEntityCapability
      • setDissimilarityScore

        public static void setDissimilarityScore​(chemaxon.struc.Molecule target,
                                                 float dissimilarity)
        Sets dissimilarity score property to target molecule. For example HitDisplayTool is able to pick it up from there.
        Parameters:
        target - the molecule which will obtain the new property
        dissimilarity - new dissimilarity score