Class MarvinStructure


  • public class MarvinStructure
    extends Structure<chemaxon.struc.Molecule>
    A representation of a molecular structure that uses the ChemAxon Molecule as its native format.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String STANDARDIZED_2D
      Key for storing 2D standardized molecules with Structure.storeMolecules(String, Molecule[], Object).
      static java.lang.String STANDARDIZED_NATIVE
      Key for storing standardized molecules with Structure.storeMolecules(String, Molecule[], Object).
    • Constructor Summary

      Constructors 
      Constructor Description
      MarvinStructure()
      Creates a new instance of MarvinStructure with an empty Molecule.
      MarvinStructure​(chemaxon.struc.Molecule mol)
      Create a new instance with a molecule specified as a Marvin Molecule instance.
      MarvinStructure​(java.lang.String mol)
      Create a new instance with the structure specified as a String.
      MarvinStructure​(java.lang.String molecule, boolean validate)
      Create, but optionally check that the molecule is a valid.
    • Field Detail

      • STANDARDIZED_2D

        public static final java.lang.String STANDARDIZED_2D
        Key for storing 2D standardized molecules with Structure.storeMolecules(String, Molecule[], Object).
        See Also:
        Constant Field Values
      • STANDARDIZED_NATIVE

        public static final java.lang.String STANDARDIZED_NATIVE
        Key for storing standardized molecules with Structure.storeMolecules(String, Molecule[], Object).
        See Also:
        Constant Field Values
    • Constructor Detail

      • MarvinStructure

        public MarvinStructure()
        Creates a new instance of MarvinStructure with an empty Molecule.
      • MarvinStructure

        public MarvinStructure​(java.lang.String mol)
        Create a new instance with the structure specified as a String. No validation of the format is performed, and if an invalid structure is used exception will occur later when the molecule needs to be converted. Only use this approach if you are sure that the structures are valid. Use the 2 argument constructor is you want to perform validation.
        Parameters:
        mol - The molecule, in one of the formats that Marvin recognises.
      • MarvinStructure

        public MarvinStructure​(chemaxon.struc.Molecule mol)
        Create a new instance with a molecule specified as a Marvin Molecule instance. This is the internal representation that is used by MarvinStructure.
        Parameters:
        mol - The Molecule instance
      • MarvinStructure

        public MarvinStructure​(java.lang.String molecule,
                               boolean validate)
                        throws java.lang.IllegalArgumentException
        Create, but optionally check that the molecule is a valid. Throws an IllegalArgumentException if the string can't be converted into a Marvin Molecule object using MolImporter
        Parameters:
        molecule - The structure
        validate - Whether to validate the structure. If so the native form of the molecule is created immediately.
        Throws:
        java.lang.IllegalArgumentException - if structure is invalid
    • Method Detail

      • getEncodedMol

        public java.lang.String getEncodedMol()
        Description copied from class: Structure
        Get the molecule in its original String form.
        Overrides:
        getEncodedMol in class Structure<chemaxon.struc.Molecule>
        Returns:
        Value of property encodedMol.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Structure<chemaxon.struc.Molecule>
      • parseExceptionException

        public java.lang.Exception parseExceptionException()
        Returns:
        The exception if parsing of molecule failed
      • asSimpleText

        public java.lang.String asSimpleText​(DFOperator operator)
        Description copied from class: Structure
        Format the structure as appropriate in smiles or smarts fromat, according to the search orerator (if available). ChemAxon extended smiles/smarts will be used if it is not possible to describe the structure in Daylight smiles/smarts.

        The decission on smiles vs. smarts is taken based on the operator. For perfect, similarity and superstructure type smiles is used, for other types smarts is used. If operator is not specified then smarts format is returned.

        To convert Molecule you can use also these two methods: ChemUtils.convertToSmilesRepresentation(chemaxon.struc.Molecule) and ChemUtils.convertToSmartsRepresentation(chemaxon.struc.Molecule).

        Specified by:
        asSimpleText in class Structure<chemaxon.struc.Molecule>
        Parameters:
        operator - The search operator if it's available. It's allowed to put null here
        Returns:
        The smiles/smarts string
      • getNative

        public chemaxon.struc.Molecule getNative()
        Get underlying Molecule.
        Specified by:
        getNative in class Structure<chemaxon.struc.Molecule>
        Returns:
        clone of the source Molecule.
      • getAllMolecules

        public chemaxon.struc.Molecule[] getAllMolecules()
        Returns:
        clone of native molecules
      • getNative2D

        public chemaxon.struc.Molecule getNative2D()
        Get the Molecule in 2 dimensional representation.
        Specified by:
        getNative2D in class Structure<chemaxon.struc.Molecule>
        Returns:
        clone of molecule in 2D
      • getAllNative2D

        public chemaxon.struc.Molecule[] getAllNative2D()
        Get the Molecules in 2 dimensional representation.
        Returns:
        clones of molecules in 2D
      • valueOf

        public static MarvinStructure valueOf​(java.lang.Object value)
        Create new instance from an instance.
        Parameters:
        value - either MarvinStructure or String.
        Returns:
        null if the value is not structure.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object