예제 #1
0
    def get_mol(self):
        '''Returns mol'''
        structure = parsers.get_mol(self.__chebi_id)

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

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

                if structure is not None:
                    break

        return None if structure is None else structure.get_structure()
예제 #2
0
 def __get_mol_id(self, chebi_id):
     '''COMMENT'''
     directory = os.path.dirname(os.path.realpath(__file__))
     textfile_read = open(directory + '/ChEBI_' + str(chebi_id) +
                          '.mol', 'r')
     mol_read = textfile_read.read()
     this_structure = Structure(mol_read, Structure.mol, 2)
     self.assertEquals(this_structure, parsers.get_mol(chebi_id))
예제 #3
0
 def __get_mol_id(self, chebi_id):
     '''COMMENT'''
     directory = os.path.dirname(os.path.realpath(__file__))
     textfile_read = open(directory + '/ChEBI_' + str(chebi_id) + '.mol',
                          'r')
     mol_read = textfile_read.read()
     this_structure = Structure(mol_read, Structure.mol, 2)
     self.assertEquals(this_structure, parsers.get_mol(chebi_id))
예제 #4
0
 def test_get_mol_neg(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_mol(-1))
예제 #5
0
 def test_get_mol_missing(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_mol(1))
예제 #6
0
 def test_get_mol_neg(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_mol(-1))
예제 #7
0
 def test_get_mol_missing(self):
     '''COMMENT'''
     self.assertIsNone(parsers.get_mol(1))