def get_smiles(self): '''Returns smiles''' structure = parsers.get_smiles(self.__chebi_id) if structure is None: structure = parsers.get_smiles(self.get_parent_id()) if structure is None: for parent_or_child_id in self.__get_all_ids(): structure = parsers.get_smiles(parent_or_child_id) if structure is not None: break return None if structure is None else structure.get_structure()
def test_get_smiles(self): '''COMMENT''' this_structure = Structure( 'NC(=[NH2+])NCC[C@H](O)[C@H]([NH3+])C([O-])=O', Structure.SMILES, 1) self.assertEquals(this_structure, parsers.get_smiles(73938))
def test_get_smiles_neg(self): '''COMMENT''' self.assertIsNone(parsers.get_smiles(-1))
def test_get_smiles_missing(self): '''COMMENT''' self.assertIsNone(parsers.get_smiles(1))