def testBicyclicDecompositionForPolyringUsingAlkaneTricyclic(self): # create testing molecule smiles = 'C1CC2CCCC3C(C1)C23' mol = Molecule().fromSMILES(smiles) # extract polyring from the molecule polyring = mol.getDisparateRings()[1][0] bicyclicList, ringOccurancesDict = bicyclicDecompositionForPolyring(polyring) # 1st test: number of cores self.assertEqual(len(bicyclicList), 3) # 2nd test: ringOccurancesDict ringInCoreOccurances = sorted(ringOccurancesDict.values()) expectedRingInCoreOccurances = [2, 2, 2] self.assertEqual(ringInCoreOccurances, expectedRingInCoreOccurances) # 3rd test: size of each bicyclic core bicyclicSizes = sorted([len(bicyclic.atoms) for bicyclic in bicyclicList]) expectedBicyclicSizes = [7, 7, 10] self.assertEqual(bicyclicSizes, expectedBicyclicSizes) # 4th test: bond info for members of each core aromaticBondNumInBicyclics = [] for bicyclic in bicyclicList: aromaticBondNum = len(findAromaticBondsFromSubMolecule(bicyclic)) aromaticBondNumInBicyclics.append(aromaticBondNum) aromaticBondNumInBicyclics = sorted(aromaticBondNumInBicyclics) expectedAromaticBondNumInBicyclics = [0, 0, 0] self.assertEqual(aromaticBondNumInBicyclics, expectedAromaticBondNumInBicyclics)
def testAddPolyRingCorrectionThermoDataFromHeuristicUsingAlkaneTricyclic(self): # create testing molecule smiles = 'C1CC2CCCC3C(C1)C23' mol = Molecule().fromSMILES(smiles) # extract polyring from the molecule polyring = mol.getDisparateRings()[1][0] thermoData = ThermoData( Tdata = ([300,400,500,600,800,1000,1500],"K"), Cpdata = ([0.0,0.0,0.0,0.0,0.0,0.0,0.0],"J/(mol*K)"), H298 = (0.0,"kJ/mol"), S298 = (0.0,"J/(mol*K)"), ) self.database._ThermoDatabase__addPolyRingCorrectionThermoDataFromHeuristic( thermoData, polyring) ringGroups, polycyclicGroups = self.database.getRingGroupsFromComments(thermoData) ringGroupLabels = [ringGroup.label for ringGroup in ringGroups] polycyclicGroupLabels = [polycyclicGroup.label for polycyclicGroup in polycyclicGroups] self.assertIn('Cyclohexane', ringGroupLabels) self.assertIn('Cyclopropane', ringGroupLabels) self.assertIn('s2_6_6_ane', polycyclicGroupLabels) self.assertIn('s2_3_6_ane', polycyclicGroupLabels)
def testAddPolyRingCorrectionThermoDataFromHeuristicUsingAlkaneTricyclic( self): # create testing molecule smiles = 'C1CC2CCCC3C(C1)C23' mol = Molecule().fromSMILES(smiles) # extract polyring from the molecule polyring = mol.getDisparateRings()[1][0] thermoData = ThermoData( Tdata=([300, 400, 500, 600, 800, 1000, 1500], "K"), Cpdata=([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "J/(mol*K)"), H298=(0.0, "kJ/mol"), S298=(0.0, "J/(mol*K)"), ) self.database._ThermoDatabase__addPolyRingCorrectionThermoDataFromHeuristic( thermoData, polyring) ringGroups, polycyclicGroups = self.database.getRingGroupsFromComments( thermoData) ringGroupLabels = [ringGroup.label for ringGroup in ringGroups] polycyclicGroupLabels = [ polycyclicGroup.label for polycyclicGroup in polycyclicGroups ] self.assertIn('Cyclohexane', ringGroupLabels) self.assertIn('Cyclopropane', ringGroupLabels) self.assertIn('s2_6_6_ane', polycyclicGroupLabels) self.assertIn('s2_3_6_ane', polycyclicGroupLabels)
def testBicyclicDecompositionForPolyringUsingAlkaneTricyclic(self): # create testing molecule smiles = 'C1CC2CCCC3C(C1)C23' mol = Molecule().fromSMILES(smiles) # extract polyring from the molecule polyring = mol.getDisparateRings()[1][0] bicyclicList, ringOccurancesDict = bicyclicDecompositionForPolyring( polyring) # 1st test: number of cores self.assertEqual(len(bicyclicList), 3) # 2nd test: ringOccurancesDict ringInCoreOccurances = sorted(ringOccurancesDict.values()) expectedRingInCoreOccurances = [2, 2, 2] self.assertEqual(ringInCoreOccurances, expectedRingInCoreOccurances) # 3rd test: size of each bicyclic core bicyclicSizes = sorted( [len(bicyclic.atoms) for bicyclic in bicyclicList]) expectedBicyclicSizes = [7, 7, 10] self.assertEqual(bicyclicSizes, expectedBicyclicSizes) # 4th test: bond info for members of each core aromaticBondNumInBicyclics = [] for bicyclic in bicyclicList: aromaticBondNum = len(findAromaticBondsFromSubMolecule(bicyclic)) aromaticBondNumInBicyclics.append(aromaticBondNum) aromaticBondNumInBicyclics = sorted(aromaticBondNumInBicyclics) expectedAromaticBondNumInBicyclics = [0, 0, 0] self.assertEqual(aromaticBondNumInBicyclics, expectedAromaticBondNumInBicyclics)
def testAddRingCorrectionThermoDataFromTreeForExistingTricyclic(self): # create testing molecule: C1CC2C3CCC(C3)C2C1 # this tricyclic molecule is already in polycyclic database # so algorithm should give complete match: s2-3_5_5_5_ane smiles = 'C1CC2C3CCC(C3)C2C1' mol = Molecule().fromSMILES(smiles) polyring = mol.getDisparateRings()[1][0] poly_groups = self.database.groups['polycyclic'] _, matched_entry, _ = self.database._ThermoDatabase__addRingCorrectionThermoDataFromTree(None, poly_groups, mol, polyring) self.assertEqual(matched_entry.label, 's2-3_5_5_5_ane')
def testAddRingCorrectionThermoDataFromTreeForExistingTricyclic(self): # create testing molecule: C1CC2C3CCC(C3)C2C1 # this tricyclic molecule is already in polycyclic database # so algorithm should give complete match: s2-3_5_5_5_ane smiles = 'C1CC2C3CCC(C3)C2C1' mol = Molecule().fromSMILES(smiles) polyring = mol.getDisparateRings()[1][0] poly_groups = self.database.groups['polycyclic'] _, matched_entry, _ = self.database._ThermoDatabase__addRingCorrectionThermoDataFromTree( None, poly_groups, mol, polyring) self.assertEqual(matched_entry.label, 's2-3_5_5_5_ane')