示例#1
0
    def get_inchi_key(self):
        '''Returns inchi key'''
        structure = parsers.get_inchi_key(self.__chebi_id)

        if structure is None:
            structure = parsers.get_inchi_key(self.get_parent_id())

        if structure is None:
            for parent_or_child_id in self.__get_all_ids():
                structure = parsers.get_inchi_key(parent_or_child_id)

                if structure is not None:
                    break

        return None if structure is None else structure.get_structure()
示例#2
0
 def test_get_inchi_key_neg_dim(self):
     '''COMMENT'''
     this_structure = Structure(
         'VIDUVSPOWYVZIC-IMJSIDKUSA-O',
         Structure.InChIKey, 123456)
     self.assertNotEquals(this_structure,
                          parsers.get_inchi_key(73938))
示例#3
0
 def test_get_inchi_key_neg_struct(self):
     '''COMMENT'''
     this_structure = Structure(
         'made_up',
         Structure.InChIKey, 1)
     self.assertNotEquals(this_structure,
                          parsers.get_inchi_key(73938))
示例#4
0
 def test_get_inchi_key_neg_type(self):
     '''COMMENT'''
     this_structure = Structure(
         'VIDUVSPOWYVZIC-IMJSIDKUSA-O',
         Structure.mol, 1)
     self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
示例#5
0
 def test_get_inchi_key_neg(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_inchi_key(-1))
示例#6
0
 def test_get_inchi_key_missing(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_inchi_key(1))
示例#7
0
 def test_get_inchi_key_neg_dim(self):
     '''COMMENT'''
     this_structure = Structure('VIDUVSPOWYVZIC-IMJSIDKUSA-O',
                                Structure.InChIKey, 123456)
     self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
示例#8
0
 def test_get_inchi_key_neg_type(self):
     '''COMMENT'''
     this_structure = Structure('VIDUVSPOWYVZIC-IMJSIDKUSA-O',
                                Structure.mol, 1)
     self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
示例#9
0
 def test_get_inchi_key_neg_struct(self):
     '''COMMENT'''
     this_structure = Structure('made_up', Structure.InChIKey, 1)
     self.assertNotEquals(this_structure, parsers.get_inchi_key(73938))
示例#10
0
 def test_get_inchi_key_neg(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_inchi_key(-1))
示例#11
0
 def test_get_inchi_key_missing(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_inchi_key(1))