コード例 #1
0
ファイル: parse_tmchem_file.py プロジェクト: ConesaLab/Padhoc
 def parse(self):
     '''
     parse tmchem file (sentence.pubtator.tmchem), save in a dictionary the sentence id, the name of the compound and the chebi name
     Save only the chebi ID, not the mesh
     '''
     with open(self.file) as f:
         for line in f:
             line=line.rstrip()
             line=line.split('\t')
             if(len(line)==6):
                 #print(line)
                 #print(line[0])
                 iddoc=line[0] #id of the sentence in TEES: ex TEES.d0.s1
                 #print(iddoc)
                 iddoc=os.path.splitext(iddoc)[0] #keep only the ID of the doc: ex TEES.d0
                 iddoc=self.tmpr+'.'+iddoc
                 #print(iddoc)
                 
                 # Some chebi are parent and some are children (duplicate and in that case, we recover and take the parent)
                 chebimesh=line[5]
                 chebi=re.search('(?<=CHEBI:)\w+',chebimesh)
                 if(chebi):
                     chebientity=ChebiEntity("CHEBI:"+chebi.group(0))
                     parent=chebientity.get_parent_id() # ex: CHEBI:22982 as for parent CHEBI:27732
                     if parent:
                         #print('take the parent: '+chebimesh+' '+parent)
                         chebimesh=parent
                 
                     if iddoc in self.dictmchem.keys():
                         #print line[3]
                         self.dictmchem[iddoc][line[3]]=chebimesh #iddoc: document ID (TEES), name as find in the text, chebimesh=chebi ID or mesh ID
                     else:
                         self.dictmchem[iddoc]={}
                         self.dictmchem[iddoc][line[3]]=chebimesh
     return self.dictmchem
コード例 #2
0
 def save_model(self, request, obj, form, change):
     if form.cleaned_data['chebi_id']:
         chebi_id = form.cleaned_data['chebi_id']
         chebi_comb = ChebiEntity('CHEBI:' + str(chebi_id))
         parent_id = chebi_comb.get_parent_id()
         if parent_id:
             s = re.findall(r'\d+', parent_id)
             chebi_id = int(s[0])
             chebi_comb = ChebiEntity('CHEBI:' + str(chebi_id))
         obj.chebi_id = chebi_id
         obj.chebi_name = chebi_comb.get_name()
     else:
         obj.chebi_name = None
     if form.cleaned_data['pubchem_id']:
         comp = Compound.from_cid(form.cleaned_data['pubchem_id'])
         obj.pubchem_name = comp.synonyms[0]
     else:
         obj.pubchem_name = None
     obj.save()
コード例 #3
0
ファイル: chebi_from_string.py プロジェクト: ConesaLab/Padhoc
 def chebi_from_dictio(self, dicofile):
     '''
     Cecile Pereira: 14 August #TODO TEST
     Read the dictionary file,
     Save the info of name, id, chebi in dictionaries.
     '''
     #print "Read chebi dictionary file"
     f=open(dicofile,'r')
     tmpid=""
     for line in f:
         if line.startswith('ID '):
             tmp=split(' ',line)
             tmpid=tmp[1]
             self.idname[tmpid]={}
         elif line.startswith('NA '):
             tmp=split(' ',line)
             tmpname=clean(tmp[1])
             self.nameid[tmpname]=tmpid
             self.idname[tmpid][tmpname]=''
         elif line.startswith('TM '):
             tmp=split(' ',line) #synonyms
             tmp=split('\@',tmp[1])
             tmp[0]=clean(tmp[0])
             self.nameid[tmp[0]]=tmpid
             self.idname[tmpid][tmp[0]]='' #all the names of the ID
         elif line.startswith('DB CHEB_'):
             tmp=split(' ',line)
             for t in tmp:
                 t=re.sub('^CHEB_','',t)
                 t=re.sub('^CHEBI:','',t)
                 t=re.sub('Not available','',t)
                 if not t == '':
                     chebi=t
                     if(chebi):
                         chebientity=ChebiEntity("CHEBI:"+chebi)
                         parent=chebientity.get_parent_id() # ex: CHEBI:22982 as for parent CHEBI:27732
                         if parent: #take the CHEBI parent...
                             self.idchebi[tmpid][parent]=''
コード例 #4
0
class TestChebiEntity(unittest.TestCase):
    '''COMMENT'''

    def setUp(self):
        '''COMMENT'''
        self.__existing = ChebiEntity('4167')
        self.__secondary = ChebiEntity('CHEBI:5585')

    def test_get_non_existing(self):
        '''COMMENT'''
        self.assertRaises(ChebiException, ChebiEntity, '-1')

    def test_get_id_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_id() == 'CHEBI:4167')

    def test_get_id_secondary(self):
        '''COMMENT'''
        self.assertTrue(self.__secondary.get_id() == 'CHEBI:5585')

    def test_get_formulae_existing(self):
        '''COMMENT'''
        this_formula = Formula('C6H12O6', 'KEGG COMPOUND')
        self.assertTrue(this_formula in self.__existing.get_formulae())

    def test_get_formulae_secondary(self):
        '''COMMENT'''
        this_formula = Formula('H2O', 'ChEBI')
        self.assertTrue(this_formula in self.__secondary.get_formulae())

    def test_get_formula_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_formula() == 'C6H12O6')

    def test_get_formula_secondary(self):
        '''COMMENT'''
        self.assertTrue(self.__secondary.get_formula() == 'H2O')

    def test_get_mass_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_mass(), 180.15588)

    def test_get_mass_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_mass(), 18.01530)

    def test_get_charge_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_charge(), 0)

    def test_get_charge_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_charge(), 0)

    def test_get_charge_secondary2(self):
        '''COMMENT'''
        self.assertEquals(-2, ChebiEntity('43474').get_charge())

    def test_get_comments_existing(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('29044')
        this_comment = Comment('General', 'General',
                               'The substituent name \'3-oxoprop-2-enyl\' is '
                               'incorrect but is used in various databases.',
                               datetime.datetime.strptime('2005-03-18',
                                                          '%Y-%M-%d'))
        self.assertTrue(this_comment in this_chebi_entity.get_comments())

    def test_get_comments_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('11505')
        this_comment = Comment('General', 'General',
                               'The substituent name \'3-oxoprop-2-enyl\' is '
                               'incorrect but is used in various databases.',
                               datetime.datetime.strptime('2005-03-18',
                                                          '%Y-%M-%d'))
        self.assertTrue(this_comment in this_chebi_entity.get_comments())

    def test_get_source_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_source(), 'KEGG COMPOUND')

    def test_get_source_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_source(), 'KEGG COMPOUND')

    def test_get_prnt_id_existing(self):
        '''COMMENT'''
        self.assertIsNone(self.__existing.get_parent_id())

    def test_get_prnt_id_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_parent_id(), 'CHEBI:15377')

    def test_get_name_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_name(), 'D-glucopyranose')

    def test_get_name_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_name(), 'water')

    def test_get_definition_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_definition(),
                         'A glucopyranose having D-configuration.')

    def test_get_definition_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('41140')
        self.assertEqual(this_chebi_entity.get_definition(),
                         'D-Glucopyranose with beta configuration at the '
                         'anomeric centre.')

    def test_get_mod_on_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_modified_on() >
                        datetime.datetime.strptime('2014-01-01',
                                                   '%Y-%M-%d'))

    def test_get_mod_on_secondary(self):
        '''COMMENT'''
        self.assertIsNotNone(self.__secondary.get_modified_on())

    def test_get_created_by_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_created_by(), 'CHEBI')

    def test_get_created_by_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_created_by(), 'ops$mennis')

    def test_get_star_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_star(), 3)

    def test_get_star_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_star(), 3)

    def test_get_db_acc_existing(self):
        '''COMMENT'''
        dat_acc = DatabaseAccession('MetaCyc accession', 'D-Glucose',
                                    'MetaCyc')
        self.assertTrue(dat_acc in self.__existing.get_database_accessions())

    def test_get_db_acc_secondary(self):
        '''COMMENT'''
        dat_acc = DatabaseAccession('MetaCyc accession', 'WATER', 'MetaCyc')
        self.assertTrue(dat_acc in self.__secondary.get_database_accessions())

    def test_get_inchi_existing(self):
        '''COMMENT'''
        inchi = 'InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/' + \
            'h2-11H,1H2/t2-,3-,4+,5-,6?/m1/s1'
        self.assertEqual(self.__existing.get_inchi(), inchi)

    def test_get_inchi_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_inchi(), 'InChI=1S/H2O/h1H2')

    def test_get_inchi_key_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_inchi_key(),
                         'WQZGKKKJIJFFOK-GASJEMHNSA-N')

    def test_get_inchi_key_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_inchi_key(),
                         'XLYOFNOQVPJJNP-UHFFFAOYSA-N')

    def test_get_smiles_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_smiles(),
                         'OC[C@H]1OC(O)[C@H](O)[C@@H](O)[C@@H]1O')

    def test_get_smiles_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_smiles(), '[H]O[H]')

    def test_get_mol_existing(self):
        '''COMMENT'''
        chebi_id = 73938
        this_chebi_entity = ChebiEntity(str(chebi_id))
        self.assertEqual(this_chebi_entity.get_mol(),
                         _read_mol_file(chebi_id))

    def test_get_mol_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_mol(), _read_mol_file(15377))

    def test_get_mol_file_existing(self):
        '''COMMENT'''
        chebi_id = 73938
        self.__get_mol_file(chebi_id, chebi_id)

    def test_get_mol_file_secondary(self):
        '''COMMENT'''
        read_id = 15377
        retrieved_id = 42857
        self.__get_mol_file(read_id, retrieved_id)

    def test_get_names_existing(self):
        '''COMMENT'''
        this_name = Name('Grape sugar', 'SYNONYM', 'KEGG COMPOUND', False,
                         'en')
        self.assertTrue(this_name in self.__existing.get_names())

    def test_get_names_secondary(self):
        '''COMMENT'''
        this_name = Name('eau', 'SYNONYM', 'ChEBI', False, 'fr')
        self.assertTrue(this_name in self.__secondary.get_names())

    def test_get_references_existing(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('15347')
        this_reference = Reference('WO2006008754', 'Patent', '',
                                   'NOVEL INTERMEDIATES FOR LINEZOLID '
                                   'AND RELATED COMPOUNDS')

        self.assertTrue(this_reference in this_chebi_entity.get_references())

    def test_get_references_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('22182')
        this_reference = Reference('WO2006008754', 'Patent', '',
                                   'NOVEL INTERMEDIATES FOR LINEZOLID '
                                   'AND RELATED COMPOUNDS')
        self.assertTrue(this_reference in this_chebi_entity.get_references())

    def test_get_cmp_orig_existing(self):
        '''COMMENT'''
        this_compound_origin = CompoundOrigin('H**o sapiens', 'NCBI:9606',
                                              None, None, None, None,
                                              'DOI', '10.1038/nbt.2488', None)
        self.assertTrue(this_compound_origin
                        in self.__existing.get_compound_origins())

    def test_get_cmp_orig_secondary(self):
        '''COMMENT'''
        this_compound_origin = CompoundOrigin('H**o sapiens', 'NCBI:9606',
                                              None, None, None, None,
                                              'DOI', '10.1038/nbt.2488', None)
        self.assertTrue(this_compound_origin
                        in self.__secondary.get_compound_origins())

    def test_get_out_existing(self):
        '''COMMENT'''
        this_relation = Relation('is_a', '17634', 'C')
        self.assertTrue(this_relation in self.__existing.get_outgoings())

    def test_get_out_secondary(self):
        '''COMMENT'''
        this_relation = Relation('has_role', 'CHEBI:48360', 'C')
        self.assertTrue(this_relation in self.__secondary.get_outgoings())

    def test_get_in_existing(self):
        '''COMMENT'''
        this_relation = Relation('has_functional_parent', 'CHEBI:15866', 'C')
        self.assertTrue(this_relation in self.__existing.get_incomings())

    def test_get_in_secondary(self):
        '''COMMENT'''
        this_relation = Relation('is_conjugate_acid_of', '29412', 'C')
        self.assertTrue(this_relation in self.__secondary.get_incomings())

    def __get_mol_file(self, read_id, retrieved_id):
        '''COMMENT'''
        mol_read = _read_mol_file(read_id)
        this_chebi_entity = ChebiEntity(str(retrieved_id))
        textfile_retrieved = open(this_chebi_entity.get_mol_filename(), 'r')
        mol_retrieved = textfile_retrieved.read()
        textfile_retrieved.close()
        self.assertEquals(mol_read, mol_retrieved)
コード例 #5
0
class TestChebiEntity(unittest.TestCase):
    '''COMMENT'''
    def setUp(self):
        '''COMMENT'''
        self.__existing = ChebiEntity('4167')
        self.__secondary = ChebiEntity('CHEBI:5585')

    def test_get_non_existing(self):
        '''COMMENT'''
        self.assertRaises(ChebiException, ChebiEntity, '-1')

    def test_get_id_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_id() == 'CHEBI:4167')

    def test_get_id_secondary(self):
        '''COMMENT'''
        self.assertTrue(self.__secondary.get_id() == 'CHEBI:5585')

    def test_get_formulae_existing(self):
        '''COMMENT'''
        this_formula = Formula('C6H12O6', 'KEGG COMPOUND')
        self.assertTrue(this_formula in self.__existing.get_formulae())

    def test_get_formulae_secondary(self):
        '''COMMENT'''
        this_formula = Formula('H2O', 'ChEBI')
        self.assertTrue(this_formula in self.__secondary.get_formulae())

    def test_get_formula_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_formula() == 'C6H12O6')

    def test_get_formula_secondary(self):
        '''COMMENT'''
        self.assertTrue(self.__secondary.get_formula() == 'H2O')

    def test_get_mass_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_mass(), 180.15588)

    def test_get_mass_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_mass(), 18.01530)

    def test_get_charge_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_charge(), 0)

    def test_get_charge_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_charge(), 0)

    def test_get_charge_secondary2(self):
        '''COMMENT'''
        self.assertEquals(-2, ChebiEntity('43474').get_charge())

    def test_get_comments_existing(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('29044')
        this_comment = Comment(
            'General', 'General',
            'The substituent name \'3-oxoprop-2-enyl\' is '
            'incorrect but is used in various databases.',
            datetime.datetime.strptime('2005-03-18', '%Y-%M-%d'))
        self.assertTrue(this_comment in this_chebi_entity.get_comments())

    def test_get_comments_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('11505')
        this_comment = Comment(
            'General', 'General',
            'The substituent name \'3-oxoprop-2-enyl\' is '
            'incorrect but is used in various databases.',
            datetime.datetime.strptime('2005-03-18', '%Y-%M-%d'))
        self.assertTrue(this_comment in this_chebi_entity.get_comments())

    def test_get_source_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_source(), 'KEGG COMPOUND')

    def test_get_source_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_source(), 'KEGG COMPOUND')

    def test_get_prnt_id_existing(self):
        '''COMMENT'''
        self.assertIsNone(self.__existing.get_parent_id())

    def test_get_prnt_id_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_parent_id(), 'CHEBI:15377')

    def test_get_name_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_name(), 'D-glucopyranose')

    def test_get_name_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_name(), 'water')

    def test_get_definition_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_definition(),
                         'A glucopyranose having D-configuration.')

    def test_get_definition_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('41140')
        self.assertEqual(
            this_chebi_entity.get_definition(),
            'D-Glucopyranose with beta configuration at the '
            'anomeric centre.')

    def test_get_mod_on_existing(self):
        '''COMMENT'''
        self.assertTrue(self.__existing.get_modified_on() >
                        datetime.datetime.strptime('2014-01-01', '%Y-%M-%d'))

    def test_get_mod_on_secondary(self):
        '''COMMENT'''
        self.assertIsNotNone(self.__secondary.get_modified_on())

    def test_get_created_by_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_created_by(), 'CHEBI')

    def test_get_created_by_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_created_by(), 'ops$mennis')

    def test_get_star_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_star(), 3)

    def test_get_star_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_star(), 3)

    def test_get_db_acc_existing(self):
        '''COMMENT'''
        dat_acc = DatabaseAccession('MetaCyc accession', 'D-Glucose',
                                    'MetaCyc')
        self.assertTrue(dat_acc in self.__existing.get_database_accessions())

    def test_get_db_acc_secondary(self):
        '''COMMENT'''
        dat_acc = DatabaseAccession('MetaCyc accession', 'WATER', 'MetaCyc')
        self.assertTrue(dat_acc in self.__secondary.get_database_accessions())

    def test_get_inchi_existing(self):
        '''COMMENT'''
        inchi = 'InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/' + \
            'h2-11H,1H2/t2-,3-,4+,5-,6?/m1/s1'
        self.assertEqual(self.__existing.get_inchi(), inchi)

    def test_get_inchi_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_inchi(), 'InChI=1S/H2O/h1H2')

    def test_get_inchi_key_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_inchi_key(),
                         'WQZGKKKJIJFFOK-GASJEMHNSA-N')

    def test_get_inchi_key_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_inchi_key(),
                         'XLYOFNOQVPJJNP-UHFFFAOYSA-N')

    def test_get_smiles_existing(self):
        '''COMMENT'''
        self.assertEqual(self.__existing.get_smiles(),
                         'OC[C@H]1OC(O)[C@H](O)[C@@H](O)[C@@H]1O')

    def test_get_smiles_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_smiles(), '[H]O[H]')

    def test_get_mol_existing(self):
        '''COMMENT'''
        chebi_id = 73938
        this_chebi_entity = ChebiEntity(str(chebi_id))
        self.assertEqual(this_chebi_entity.get_mol(), _read_mol_file(chebi_id))

    def test_get_mol_secondary(self):
        '''COMMENT'''
        self.assertEqual(self.__secondary.get_mol(), _read_mol_file(15377))

    def test_get_mol_file_existing(self):
        '''COMMENT'''
        chebi_id = 73938
        self.__get_mol_file(chebi_id, chebi_id)

    def test_get_mol_file_secondary(self):
        '''COMMENT'''
        read_id = 15377
        retrieved_id = 42857
        self.__get_mol_file(read_id, retrieved_id)

    def test_get_names_existing(self):
        '''COMMENT'''
        this_name = Name('Grape sugar', 'SYNONYM', 'KEGG COMPOUND', False,
                         'en')
        self.assertTrue(this_name in self.__existing.get_names())

    def test_get_names_secondary(self):
        '''COMMENT'''
        this_name = Name('eau', 'SYNONYM', 'ChEBI', False, 'fr')
        self.assertTrue(this_name in self.__secondary.get_names())

    def test_get_references_existing(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('15347')
        this_reference = Reference(
            'WO2006008754', 'Patent', '', 'NOVEL INTERMEDIATES FOR LINEZOLID '
            'AND RELATED COMPOUNDS')

        self.assertTrue(this_reference in this_chebi_entity.get_references())

    def test_get_references_secondary(self):
        '''COMMENT'''
        this_chebi_entity = ChebiEntity('22182')
        this_reference = Reference(
            'WO2006008754', 'Patent', '', 'NOVEL INTERMEDIATES FOR LINEZOLID '
            'AND RELATED COMPOUNDS')
        self.assertTrue(this_reference in this_chebi_entity.get_references())

    def test_get_cmp_orig_existing(self):
        '''COMMENT'''
        this_compound_origin = CompoundOrigin('H**o sapiens', 'NCBI:9606',
                                              None, None, None, None, 'DOI',
                                              '10.1038/nbt.2488', None)
        self.assertTrue(
            this_compound_origin in self.__existing.get_compound_origins())

    def test_get_cmp_orig_secondary(self):
        '''COMMENT'''
        this_compound_origin = CompoundOrigin('H**o sapiens', 'NCBI:9606',
                                              None, None, None, None, 'DOI',
                                              '10.1038/nbt.2488', None)
        self.assertTrue(
            this_compound_origin in self.__secondary.get_compound_origins())

    def test_get_out_existing(self):
        '''COMMENT'''
        this_relation = Relation('is_a', '17634', 'C')
        self.assertTrue(this_relation in self.__existing.get_outgoings())

    def test_get_out_secondary(self):
        '''COMMENT'''
        this_relation = Relation('has_role', 'CHEBI:48360', 'C')
        self.assertTrue(this_relation in self.__secondary.get_outgoings())

    def test_get_in_existing(self):
        '''COMMENT'''
        this_relation = Relation('has_functional_parent', 'CHEBI:15866', 'C')
        self.assertTrue(this_relation in self.__existing.get_incomings())

    def test_get_in_secondary(self):
        '''COMMENT'''
        this_relation = Relation('is_conjugate_acid_of', '29412', 'C')
        self.assertTrue(this_relation in self.__secondary.get_incomings())

    def __get_mol_file(self, read_id, retrieved_id):
        '''COMMENT'''
        mol_read = _read_mol_file(read_id)
        this_chebi_entity = ChebiEntity(str(retrieved_id))
        textfile_retrieved = open(this_chebi_entity.get_mol_filename(), 'r')
        mol_retrieved = textfile_retrieved.read()
        textfile_retrieved.close()
        self.assertEquals(mol_read, mol_retrieved)