コード例 #1
0
 def testMakeFromDct(self):
     if IGNORE_TEST:
         return
     config.setConfiguration(TEST_CFG_FILE)
     config_dct = config.getConfiguration()
     dct = config_dct[cn.CFG_MOIETY_STRUCTURE]
     mss1 = MoietyStoichiometry.makeFromDct(dct["ATP"])
     mss2 = [MoietyStoichiometry("A", 1), MoietyStoichiometry("P", 3)]
     self.assertTrue(all([m1.isEqual(m2) for m1, m2 in zip(mss1, mss2)]))
コード例 #2
0
 def testGetMoietys(self):
     if IGNORE_TEST:
         return
     m_s1 = MoietyStoichiometry(Moiety(MOIETY_NAME1), NUM1)
     m_s2 = MoietyStoichiometry(MOIETY_NAME2, NUM2)
     m_s3 = MoietyStoichiometry(MOIETY_NAME1, NUM2)
     molecule = Molecule(str(m_s1))
     molecule = molecule.append(Moiety(str(m_s2)))
     moietys = molecule.getMoietys()
     expected = [Moiety(MOIETY_NAME1), Moiety(MOIETY_NAME2)]
     for moiety in moietys:
         self.assertTrue(any([moiety.isEqual(e) for e in expected]))
コード例 #3
0
 def testCountMoietys(self):
     if IGNORE_TEST:
         return
     moiety_stoich = MoietyStoichiometry(Molecule(MOIETY_NAME1), NUM1)
     mole_stoich = MoleculeStoichiometry(Molecule(str(moiety_stoich)), NUM2)
     df = mole_stoich.countMoietys()
     self.assertEqual(df.columns.tolist(), [cn.VALUE])
     expected = NUM1 * NUM2
     trues = [expected == n for n in df[cn.VALUE]]
コード例 #4
0
 def testExtractMoietyStoichiometrys(self):
     if IGNORE_TEST:
         return
     for expected, strings in MOLECULE_STOICHIOMETRY_STGS.items():
         moietys = list(set([e[0] for e in expected]))
         moietys.sort()
         m_ss = [MoietyStoichiometry(m, 1) for m in moietys]
         for stg in strings:
             result = Molecule.getMoietyStoichiometrys(stg)
             trues = [x.isEqual(y) for x, y in zip(result, m_ss)]
             self.assertTrue(all(trues))
コード例 #5
0
 def testExtractMoietyStoichiometrys(self):
     if IGNORE_TEST:
         return
     moiety_stoich = MoietyStoichiometry(Molecule(MOIETY_NAME1), NUM1)
     mole_stoich = MoleculeStoichiometry(Molecule(str(moiety_stoich)), NUM2)
コード例 #6
0
 def testStoichiometry(self):
     moiety_stoichiometry = MoietyStoichiometry(Moiety(MOIETY_NAME1), NUM1)
     self.assertEqual(moiety_stoichiometry.moiety.name, MOIETY_NAME1)
     self.assertEqual(moiety_stoichiometry.stoichiometry, NUM1)