![]() |
Molecule - Molecule class
use Molecule;
use Molecule qw(:all);
Molecule class provides the following methods:
new, AddAtom, AddAtoms, AddBond, AddBonds, AddHydrogens, AddPolarHydrogens , ClearRings, Copy, DeleteAromaticity, DeleteAtom, DeleteAtoms, DeleteBond , DeleteBonds, DeleteHydrogens, DeletePolarHydrogens, DetectAromaticity , DetectRings, FormatElementalCompositionInformation, GetAllAtomPaths , GetAllAtomPathsStartingAt, GetAllAtomPathsStartingAtWithLengthUpto , GetAllAtomPathsWithLengthUpto, GetAtomNeighborhoods , GetAtomNeighborhoodsWithRadiusUpto, GetAtomPathBonds, GetAtomPaths , GetAtomPathsBetween, GetAtomPathsStartingAt, GetAtomPathsStartingAtWithLengthUpto , GetAtomPathsWithLengthUpto, GetAtoms, GetBonds, GetCharge, GetConnectedComponents , GetConnectedComponentsAtoms, GetElementalComposition, GetElementsAndNonElements , GetExactMass, GetFormalCharge, GetFusedAndNonFusedRings , GetLargestConnectedComponent, GetLargestConnectedComponentAtoms, GetLargestRing , GetMolecularFormula, GetMolecularWeight, GetNumOfAtoms, GetNumOfBonds , GetNumOfConnectedComponents, GetNumOfHeavyAtoms, GetNumOfHydrogenAtoms , GetNumOfMissingHydrogenAtoms, GetNumOfNonHydrogenAtoms , GetNumOfRings, GetNumOfRingsWithEvenSize, GetNumOfRingsWithOddSize , GetNumOfRingsWithSize, GetNumOfRingsWithSizeGreaterThan , GetNumOfRingsWithSizeLessThan, GetRingBonds, GetRings, GetRingsWithEvenSize , GetRingsWithOddSize, GetRingsWithSize, GetRingsWithSizeGreaterThan , GetRingsWithSizeLessThan, GetSizeOfLargestRing, GetSizeOfSmallestRing , GetSmallestRing, GetSpinMultiplicity, GetTopologicallySortedAtoms, HasAtom , HasBond, HasFusedRings, HasNoRings, HasOnlyOneRing, HasRings, IsMolecule , IsThreeDimensional, KeepLargestComponent, NewAtom, NewBond, SetActiveRings , StringifyMolecule
The following methods can also be used as functions:
FormatElementalCompositionInformation, IsMolecule
Molecule class is derived from ObjectProperty base class which provides methods not explictly defined in Molecule or ObjectProperty class using Perl's AUTOLOD functionality. These methods are generated on-the-fly for a specified object property:
Using specified Atom property names and values hash, new method creates a new object and returns a reference to newly created Atom object. By default, the following properties are initialized:
Examples:
Adds an Atom to a Molecule and returns Molecule
Adds Atoms to a Molecule and returns Molecule
Adds a Bond to a Molecule and returns Molecule
Adds Bonds to a Molecule and returns Molecule
Adds hydrogens to each atom in a Molecule and returns total number of hydrogens added. The current release of MayaChemTools doesn't assign hydrogen positions.
Adds hydrogens to each polar atom - N, O, P or S - in a Molecule and returns total number of polar hydrogens added. The current release of MayaChemTools doesn't assign hydrogen positions.
Deletes all rings associated with Molecule and returns Molecule
Copies Molecule and its associated data using Storable::dclone and returns a new Molecule object
Deletes aromatic property associated with all atoms and bonds in a Molecule and returns Molecule
Deletes Atom from a Molecule and returns Molecule
Deletes Atoms from a Molecule and returns Molecule
Deletes Bond from a Molecule and returns Molecule
Deletes Bonds from a Molecule and returns Molecule
Removes hydrogens from each atom in a Molecule and returns total number of hydrogens deleted
Removes hydrogens to each polar atom - N, O, P or S - in a Molecule and returns total number of polar hydrogens deleted
Associates Aromatic property to atoms and bonds involved in aromatic rings in a Molecule and returns Molecule.
This method assumes the ring detection has already been perfomed using DetectRings. And any existing Aromatic property associated with atoms and bonds is deleted before performing aromaticity detection.
Notes:
o Ring aromaticity is determined using Huckel's rule: a ring containing 4n + 2 pi electrons is considered aromatic.
o Hetrocyclic rings containing N, O and S atoms fall into two classes: Basic aromatic and Non-basic atomatic. In Basic aromatic hetrocyclic rings, hetroatom itself is involved in a double bond. (e.g. Pyridine) However, in non-basic hetrocyclic rings, hetroatom might have an attached hydrogen arom and the remaining lone pair contribute to electron delocalization and contributes to 4n + 2 electrons. (e.g. Pyrrole, Furan)
o For molecules containing fused rings, each fused ring set is considered as one aromatic system for counting pi electrons to satisfy Huckel's rule; In case of a failure, rings in fused set are treated individually for aromaticity detection. Additionally, non-fused rings are handled on their own during aromaticity detection.
Detects rings in a Molecule and returns Molecule. Ring detection is performed using DetectCycles method avaible in Graph class which in turn uses methods available CyclesDetection class. CyclesDetection class implements collapsing path graph [Ref 31] methodology to detect all cycles in a graph.
Using ElementsRef and ElementCompositionRef arrays referneces containg informatio about elements and their composition, formats elemental composition information and returns a FormattedInfo string. Defaule Precision value: 2.
Returns all paths as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to to all possible paths for each atom in molecule with all possible lengths and sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
For molecule without any rings, this method returns the same set of atom paths as GetAtomPaths method.
Returns all atom paths starting from StartAtom as a reference to an array containing reference to arrays with path Atom objects.
Path atoms atoms correspond to to all possible paths for specified atom in molecule with all possible lengths and sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
For molecule without any rings, this method returns the same set of atom paths as GetAtomPathsStartingAt method.
Returns atom paths starting from StartAtom with length up to Length as a reference to an array containing reference to arrays with path Atom objects.
Path atoms atoms correspond to all possible paths for specified atom in molecule with length up to a specified length and sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
For molecule without any rings, this method returns the same set of atom paths as GetAtomPathsStartingAtWithLengthUpto method.
Returns all atom paths with length up to Length as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to to all possible paths for each atom in molecule with length up to a specified length and sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
For molecule without any rings, this method returns the same set of atom paths as as GetAtomPathsWithLengthUpto method.
Returns atom neighborhoods around a StartAtom as an array containing references to arrays with neighborhood Atom objects at possible radii
Returns atom neighborhoods around a StartAtom as an array containing references to arrays with neighborhood Atom objects up to Radius
Returns an array containing Bond objects corresponding to successive pair of atoms in PathAtoms
Returns all paths as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to to all possible paths for each atom in molecule with all possible lengths and no sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
Returns all paths as between StartAtom and EndAtom as a reference to an array containing reference to arrays with path Atom objects.
For molecules with rings, atom paths array contains may contain two paths.
Returns paths starting at StartAtom as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to all possible paths for specified atom in molecule with all possible lengths and no sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
Returns paths starting at StartAtom with length up to Length as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to all possible paths for specified atom in molecule with length upto a specified length and no sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
Returns all paths with length up to Length as a reference to an array containing reference to arrays with path Atom objects.
Path atoms correspond to all possible paths for each atom in molecule with length upto a specified length and no sharing of bonds in paths traversed. By default, rings are included in paths. A path containing a ring is terminated at an atom completing the ring.
Returns an array of Atoms in a Molecule. In scalar context, it returns number of atoms. Additionally, Atoms array can be filtered by any user specifiable valid Atom class method.
Returns an array of Bonds in a Molecule. In scalar context, it returns number of bonds
Returns net charge on a Molecule using one of the following two methods: explicitly set Charge property or sum of partial atomic charges on each atom.
Returns a reference to an array containing Molecule objects corresponding to connected components sorted in decreasing order of component size in a Molecule
Returns an array containing references to arrays with Atom objects corresponding to atoms of connected components sorted in order of component decreasing size in a Molecule
Calculates elemental composition and returns references to arrays containing elements and their percent composition in a Molecule. By default, missing hydrogens are included during the calculation.
Counts elements and non-elements in a Molecule and returns references to hashes containing element and non-element as hash keys with values corresponding to their count. By default, missing hydrogens are not added to the element hash.
Returns exact mass of a Molecule corresponding to sum of exact masses of all the atoms
Returns net formal charge on a Molecule using one of the following two methods: explicitly set FormalCharge property or sum of formal charges on each atom.
FormalCharge is different from Charge property of the molecule which corresponds to sum of partial atomic charges explicitly set for each atom using a specific methodology.
Returns references to array of fused ring sets and non-fused rings in a Molecule. Fused ring sets array reference contains refernces to arrays of rings corresponding to ring Atom objects; Non-fused rings array reference contains references to arrays of ring Atom objects.
Returns a reference to Molecule object corresponding to a largest connected component in a Molecule
Returns a reference to an array of Atom objects corresponding to a largest connected component in a Molecule
Returns an array of Atoms objects corresponding to a largest ring in a Molecule.
Returns molecular formula of a Molecule by collecting information about all atoms in the molecule and composing the formula using Hills ordering system:
Notes:
Returns molecular weight of a Molecule corresponding to sum of atomic weights of all the atoms
Returns number of atoms in a Molecule
Returns number of bonds in a Molecule
Returns number of connected components in a Molecule
Returns number of heavy atoms, non-hydrogen atoms, in a Molecule
Returns number of hydrogen atoms in a Molecule
Returns number of hydrogen atoms in a Molecule
Returns number of non-hydrogen atoms in a Molecule.
Returns number of rings in a Molecule
Returns number of rings with even size in a Molecule
Returns number of rings with odd size in a Molecule
Returns number of rings with Size in a Molecule
Returns number of rings with size greater than Size in a Molecule
Returns number of rings with size less than Size in a Molecule
Returns an array of ring Bond objects correponding to an array of ring Atoms in a Molecule.
Returns rings as an array containing references to arrays of ring Atom objects in a Molecule
Returns even size rings as an array containing references to arrays of ring Atom objects in a Molecule
Returns odd size rings as an array containing references to arrays of ring Atom objects in a Molecule
Returns rings with Size as an array containing references to arrays of ring Atom objects in a Molecule
Returns rings with size greater than Size as an array containing references to arrays of ring Atom objects in a Molecule
Returns rings with size less than Size as an array containing references to arrays of ring Atom objects in a Molecule
Returns size of the largest ring in a Molecule
Returns size of the smalles ring in a Molecule
Returns an array containing Atom objects corresponding to the smallest ring in a Molecule
Returns net spin multiplicity of a Molecule using one of the following two methods: explicitly set SpinMultiplicity property or sum of spin multiplicity on each atom.
Returns an array of topologically sorted Atom objects starting from StartAtom or an arbitrary atom in a Molecule
Returns 1 or 0 based on whether Atom is present in a Molecule
Returns 1 or 0 based on whether Bond is present in a Molecule
Returns 1 or 0 based on whether any fused rings set is present in a Molecule
Returns 0 or 1 based on whether any ring is present in a Molecule
Returns 1 or 0 based on whether only one ring is present in a Molecule
Returns 1 or 0 based on whether rings are present in a Molecule
Returns 1 or 0 based on whether Object is a Molecule object
Returns 1 or 0 based on whether any atom in Molecule has a non-zero value for Z coordinate
Deletes atoms corresponding to all other connected components Except for the largest connected component in a Molecule and returns Molecule
Creates a new atom using AtomPropertyNamesAndValues, add its to Molecule, and returns new Atom object
Creates a new bond using AtomPropertyNamesAndValues, add its to Molecule, and returns new Bond object
Sets up type of detected ring sets to use during all ring related methods and returns Molecule. Possible RingType values: Independent or All. By default, Independent ring set is used during all ring methods.
Returns a string containing information about Molecule object
Atom.pm, Bond.pm, MoleculeFileIO.pm, MolecularFormula.pm
Copyright (C) 2004-2008 Manish Sud. All rights reserved.
This file is part of MayaChemTools.
MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.