def testGetMoietys(self): m_ss = [] for stgs in MOIETY_STOICHIOMETRY_STGS.values(): m_ss.extend([MoietyStoichiometry.make(s) for s in stgs]) moietys = MoietyStoichiometry.getMoietys(m_ss) self.assertEqual(len(MOIETY_STOICHIOMETRY_STGS.keys()), len(moietys))
def testMake(self): if IGNORE_TEST: return for expected, strings in MOIETY_STOICHIOMETRY_STGS.items(): for stg in strings: result = MoietyStoichiometry.make(stg) self.assertEqual(result.moiety.name, expected[0]) self.assertEqual(result.stoichiometry, expected[1])
def getMoietyStoichiometrys(self): """ :return list-MoietyStoichiometry: """ new_name = self._reformat() stgs = new_name.split(cn.MOIETY_DOUBLE_SEPARATOR) result = [MoietyStoichiometry.make(ms) for ms in stgs] result.sort() return result
def moiety_stoichiometrys(self): done = False if self._moiety_stoichiometrys is None: config_dct = config.getConfiguration() if cn.CFG_MOIETY_STRUCTURE in config_dct: dct = config_dct[cn.CFG_MOIETY_STRUCTURE] if self.name in dct.keys(): self._moiety_stoichiometrys = \ MoietyStoichiometry.makeFromDct(dct[self.name]) done = True else: done = True if not done: new_name = self._reformat() stgs = new_name.split(cn.MOIETY_DOUBLE_SEPARATOR) result = [MoietyStoichiometry.make(ms) for ms in stgs] result.sort() self._moiety_stoichiometrys = result return self._moiety_stoichiometrys