def testBuildMimDiseasesDict(self): mim2gene_file = 'test_files/DO/test_mim2gene.csv' genemap_file = 'test_files/DO/test_genemap.csv' mim2entrez_dict = process_do.build_mim2entrez_dict(mim2gene_file) mim_diseases = process_do.build_mim_diseases_dict(genemap_file, mim2entrez_dict) gene_tuples_dict = {} for mimid, mimdisease in mim_diseases.iteritems(): gene_tuples_dict[mimid] = mimdisease.genetuples desired_gene_tuples = { '604367': [('5468', 'C')], '125853': [('5468', 'C')], '609734': [('5443', 'C')], '609338': [('5468', 'C')], '601665': [('8431', 'P'), ('5443', 'C'), ('51738', 'P'), ('5468', 'C'), ('6492', 'C'), ('4160', 'C')] } phetypes_dict = {} for mimid, mimdisease in mim_diseases.iteritems(): phetypes_dict[mimid] = mimdisease.phe_mm desired_phenotypes = {'604367': '(3)', '125853': '(3)', '609734': '(3)', '609338': '(3)', '601665': '(3)'} self.assertEqual(gene_tuples_dict, desired_gene_tuples) self.assertEqual(phetypes_dict, desired_phenotypes)
def testAddDOTermAnnotations(self): do_obo_file = 'test_files/DO/test_do_obo_file.obo' doid_omim_dict = process_do.build_doid_omim_dict(do_obo_file) mim2gene_file = 'test_files/DO/test_mim2gene.csv' genemap_file = 'test_files/DO/test_genemap.csv' mim2entrez_dict = process_do.build_mim2entrez_dict(mim2gene_file) mim_diseases = process_do.build_mim_diseases_dict(genemap_file, mim2entrez_dict) process_do.add_do_term_annotations( doid_omim_dict, self.disease_ontology, mim_diseases) # We know from testBuildOmimDict above that this is the only # one with OMIM xrefs doid = 'DOID:9970' do_term = self.disease_ontology.get_term(doid) annot_dict = {} for annotation in do_term.annotations: if annotation.gid not in annot_dict: annot_dict[annotation.gid] = [] else: annot_dict[annotation.gid].append(annotation.ref) desired_annots = {4160: [], 8431: [], 51738: [], 5443: [], 5468: [], 6492: []} self.assertEqual(annot_dict, desired_annots)
def testBuildMim2EntrezDict(self): mim2gene_file = 'test_files/DO/test_mim2gene.csv' mim2entrez_dict = process_do.build_mim2entrez_dict(mim2gene_file) desired_output = {'155541': '4160', '604630': '8431', '601487': '5468', '605353': '51738', '176830': '5443', '603128': '6492', '100640': '216', '616919': '22844', '616923': '388591'} self.assertEqual(mim2entrez_dict, desired_output)