def detetminePrimaryAmine(self, nitrogenIndex): """ Return primary amine Molecule object with proper ring classification, if it exists on a ring Return false if nitrogen is not a primary amine nitrogenIndex (int) : The index of the nitrogen in the smiles code to be analyzed for being a primary amine """ nitrogenBonds = self.bondData[ nitrogenIndex] # Get bonds connected to nitrogen if (len(nitrogenBonds) == 1 # Primary amines have one bond and not self.BOND_REGEX.findall( nitrogenBonds[0].symbol) # That must be a single bond ): # Otherwise, nitrogen is not a primary amine bondedIndex = nitrogenBonds[0].index primaryAmine = Molecule( "RN", "PrimaryAmine") # Create primary amine Molecule object primaryAmine.atomData[ 0].index = bondedIndex # Set the R group index to the smiles bonded nitrogen index primaryAmine.atomData[ 1].index = nitrogenIndex # Set the nitrogen index to the smiles code nitrogen index if bondedIndex in self.AROMATICINDICES: # Add aromatic nomenclature if necessary primaryAmine.NAME = "AromaticPrimaryAmine" elif bondedIndex in self.CYCLICINDICES: # Or cyclic nomenclature primaryAmine.NAME = "CyclicPrimaryAmine" return primaryAmine # Return the primary amine object if true return False # Otherwise return false
def determineAlcoholGroups(self, functionalGroups): """ Appends the functional groups created from alocholic oxygens, with ring classifications, to the functionalGroups list passed in. functionalGroups (list) : List of Molecule obejects that represent the functional groups of a SMILES code Notes: This function looks to see if the alcoholic oxygen is attached within an aromatic, non-aromatic ring strucutres, or no at all Build upon alochol indices found in the molecule """ for index in self.ALCOHOLICINDICES: alohcolBond = self.bondData[index] alochol = Molecule("RO", "Alcohol") alochol.atomData[0].index = alohcolBond[0].index alochol.atomData[1].index = index if alohcolBond[0].index in self.AROMATICINDICES: alochol.NAME = "AromaticAlcohol" elif alohcolBond[0].index in self.CYCLICINDICES: alochol.NAME = "CyclicAlcohol" functionalGroups.append(alochol) return