def setUp(self): # pylint; disable-msg=C0103 """test fixture""" self.search_distances = {'upstream': (-20, 150)} self.scan_distances = {'upstream': (-30, 250)} self.ratio_matrix = dm.create_from_csv('example_data/hal/halo_ratios5.tsv', filters=[dm.nochange_filter, dm.center_scale_filter]) self.organism = testutil.make_halo(self.search_distances, self.scan_distances, self.ratio_matrix) self.config_params = {'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'num_cores': None, 'memb.clusters_per_row': 2, 'memb.clusters_per_col': int(round(43 * 2.0 / 3.0)), 'num_clusters': 43, 'output_dir': 'out', 'remap_network_nodes': False, 'use_BSCM': False, 'num_iterations': 2000, 'debug': {}, 'search_distances': {'upstream': (-20, 150)}, 'Columns': {'schedule': lambda i: True }, 'Rows': {'schedule': lambda i: True, 'scaling': ('scaling_const', 6.0) }, 'Motifs': {'schedule': lambda i: True, 'scaling': ('scaling_rvec', 'seq(0, 1, length=num_iterations*3/4)')}, 'MEME': {'version': '4.3.0', 'global_background': False, 'schedule': lambda i: True, 'nmotifs_rvec': 'c(rep(1, num_iterations/3), rep(2, num_iterations/3))', 'max_width': 24, 'arg_mod': 'zoops', 'background_order': 3, 'use_revcomp': 'True'}, 'Networks': {'schedule': lambda i: True, 'scaling': ('scaling_rvec', 'seq(1e-5, 0.5, length=num_iterations*3/4)')}} self.membership = self.__read_members() # relies on config_params self.iteration_result = { 'iteration': 51, 'score_means': {} }
def test_motif_scoring(self): """tests the motif scoring in integration""" search_distances = {'upstream': (-20, 150)} scan_distances = {'upstream': (-30, 250)} matrix_factory = dm.DataMatrixFactory([dm.nochange_filter, dm.center_scale_filter]) infile = util.read_dfile('example_data/hal/halo_ratios5.tsv', has_header=True, quote='\"') ratio_matrix = matrix_factory.create_from(infile) organism = testutil.make_halo(search_distances, scan_distances, ratio_matrix) membership = FakeMembership() config_params = {'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'num_clusters': 1, 'output_dir': 'out', 'debug': {}, 'search_distances': {'upstream': (-20, 150)}, 'num_iterations': 2000, 'MEME': {'schedule': lambda i: True, 'version': '4.3.0', 'global_background': False, 'arg_mod': 'zoops', 'nmotifs_rvec': 'c(rep(1, num_iterations/3), rep(2, num_iterations/3))', 'use_revcomp': 'True', 'max_width': 24, 'background_order': 3}, 'Motifs': {'schedule': lambda i: True, 'scaling': ('scaling_const', 1.0)}} func = motif.MemeScoringFunction(organism, membership, ratio_matrix, config_params=config_params) iteration_result = { 'iteration': 100 } matrix = func.compute(iteration_result)
def setUp(self): # pylint; disable-msg=C0103 """test fixture""" self.search_distances = {'upstream': (-20, 150)} self.scan_distances = {'upstream': (-30, 250)} matrix_factory = dm.DataMatrixFactory( [dm.nochange_filter, dm.center_scale_filter]) infile = util.read_dfile('example_data/hal/halo_ratios5.tsv', has_header=True, quote='\"') self.ratio_matrix = matrix_factory.create_from(infile) self.organism = testutil.make_halo(self.search_distances, self.scan_distances, self.ratio_matrix) self.config_params = { 'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'memb.clusters_per_row': 2, 'memb.clusters_per_col': int(round(43 * 2.0 / 3.0)), 'num_clusters': 43, 'num_iterations': 2000 } self.membership = self.__read_members() # relies on config_params self.iteration_result = {'iteration': 51}
def test_motif_scoring(self): """tests the motif scoring in integration""" search_distances = {"upstream": (-20, 150)} scan_distances = {"upstream": (-30, 250)} matrix_factory = dm.DataMatrixFactory([dm.nochange_filter, dm.center_scale_filter]) infile = util.read_dfile("example_data/hal/halo_ratios5.tsv", has_header=True, quote='"') ratio_matrix = matrix_factory.create_from(infile) organism = testutil.make_halo(search_distances, scan_distances, ratio_matrix) membership = FakeMembership() config_params = { "memb.min_cluster_rows_allowed": 3, "memb.max_cluster_rows_allowed": 70, "multiprocessing": False, "num_clusters": 1, "output_dir": "out", "debug": {}, "search_distances": {"upstream": (-20, 150)}, "num_iterations": 2000, "MEME": { "schedule": lambda i: True, "version": "4.3.0", "global_background": False, "arg_mod": "zoops", "nmotifs_rvec": "c(rep(1, num_iterations/3), rep(2, num_iterations/3))", "use_revcomp": "True", "max_width": 24, "background_order": 3, }, "Motifs": {"schedule": lambda i: True, "scaling": ("scaling_const", 1.0)}, } func = motif.MemeScoringFunction(organism, membership, ratio_matrix, config_params=config_params) iteration_result = {"iteration": 100} matrix = func.compute(iteration_result)
def test_motif_scoring(self): """tests the motif scoring in integration""" search_distances = {'upstream': (-20, 150)} scan_distances = {'upstream': (-30, 250)} matrix_factory = dm.DataMatrixFactory( [dm.nochange_filter, dm.center_scale_filter]) infile = util.read_dfile('example_data/hal/halo_ratios5.tsv', has_header=True, quote='\"') ratio_matrix = matrix_factory.create_from(infile) organism = testutil.make_halo(search_distances, scan_distances, ratio_matrix) membership = FakeMembership() config_params = { 'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'num_clusters': 1, 'output_dir': 'out', 'debug': {}, 'search_distances': { 'upstream': (-20, 150) }, 'num_iterations': 2000, 'MEME': { 'schedule': lambda i: True, 'version': '4.3.0', 'global_background': False, 'arg_mod': 'zoops', 'nmotifs_rvec': 'c(rep(1, num_iterations/3), rep(2, num_iterations/3))', 'use_revcomp': 'True', 'max_width': 24, 'background_order': 3 }, 'Motifs': { 'schedule': lambda i: True, 'scaling': ('scaling_const', 1.0) } } func = motif.MemeScoringFunction(organism, membership, ratio_matrix, config_params=config_params) iteration_result = {'iteration': 100} matrix = func.compute(iteration_result)
def setUp(self): # pylint; disable-msg=C0103 """test fixture""" self.search_distances = {'upstream': (-20, 150)} self.scan_distances = {'upstream': (-30, 250)} self.ratio_matrix = dm.create_from_csv('example_data/hal/halo_ratios5.tsv', filters=[dm.nochange_filter, dm.center_scale_filter]) self.organism = testutil.make_halo(self.search_distances, self.scan_distances, self.ratio_matrix) self.config_params = {'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'memb.clusters_per_row': 2, 'memb.clusters_per_col': int(round(43 * 2.0 / 3.0)), 'num_clusters': 43, 'num_iterations': 2000} self.membership = self.__read_members() # relies on config_params self.iteration_result = { 'iteration': 51 }
def test_get_one_sequence(self): """get one simple sequence""" search_distances = {'upstream': (-20, 150)} scan_distances = {'upstream': (-30, 250)} halo = testutil.make_halo(search_distances, scan_distances) print("------") print("VNG1551G: ", halo.features_for_genes(['VNG1551G'])) print("VNG1550G: ", halo.features_for_genes(['VNG1550G'])) print("VNG1561C: ", halo.features_for_genes(['VNG1561C'])) print("------") seq = halo.sequences_for_genes_search(['VNG1551G'], 'upstream') self.assertTrue('NP_280354.1' in seq) print("FINAL LOC: ", seq['NP_280354.1'][0]) """ operon_map = halo.operon_map() for key, value in operon_map.items(): print("'%s' -> '%s'" % (key, value)) print("OPERON MAPPED TO: ", halo.operon_map()['NP_280354.1']) """ self.assertEquals('GTGATTCGACCATTACTGCAAGTTCAGACGACCCCAATTCAAGTAGTTTTGTGTAACCGCCGGCGTCGGGGGCGCTCGCGCCCATCTAAGAAAGCTCACTTTCCCTAATACAATCAAAATTGTTTTGGGTGCTTCTGACGTTGTGCCACCGATGGCACAGACACAGCTCC', seq['NP_280354.1'][1])
def test_get_one_sequence(self): """get one simple sequence""" search_distances = {'upstream': (-20, 150)} scan_distances = {'upstream': (-30, 250)} halo = testutil.make_halo(search_distances, scan_distances) print "------" print "VNG1551G: ", halo.features_for_genes(['VNG1551G']) print "VNG1550G: ", halo.features_for_genes(['VNG1550G']) print "VNG1561C: ", halo.features_for_genes(['VNG1561C']) print "------" seq = halo.sequences_for_genes_search(['VNG1551G'], 'upstream') self.assertTrue('NP_280354.1' in seq) print "FINAL LOC: ", seq['NP_280354.1'][0] """ operon_map = halo.operon_map() for key, value in operon_map.items(): print "'%s' -> '%s'" % (key, value) print "OPERON MAPPED TO: ", halo.operon_map()['NP_280354.1'] """ self.assertEquals( 'GTGATTCGACCATTACTGCAAGTTCAGACGACCCCAATTCAAGTAGTTTTGTGTAACCGCCGGCGTCGGGGGCGCTCGCGCCCATCTAAGAAAGCTCACTTTCCCTAATACAATCAAAATTGTTTTGGGTGCTTCTGACGTTGTGCCACCGATGGCACAGACACAGCTCC', seq['NP_280354.1'][1])
def setUp(self): # pylint; disable-msg=C0103 """test fixture""" self.search_distances = {'upstream': (-20, 150)} self.scan_distances = {'upstream': (-30, 250)} matrix_factory = dm.DataMatrixFactory([dm.nochange_filter, dm.center_scale_filter]) infile = util.read_dfile('example_data/hal/halo_ratios5.tsv', has_header=True, quote='\"') self.ratio_matrix = matrix_factory.create_from(infile) self.organism = testutil.make_halo(self.search_distances, self.scan_distances, self.ratio_matrix) self.config_params = {'memb.min_cluster_rows_allowed': 3, 'memb.max_cluster_rows_allowed': 70, 'multiprocessing': False, 'num_cores': None, 'memb.clusters_per_row': 2, 'memb.clusters_per_col': int(round(43 * 2.0 / 3.0)), 'num_clusters': 43, 'output_dir': 'out', 'remap_network_nodes': False, 'use_BSCM': False, 'num_iterations': 2000, 'debug': {}, 'search_distances': {'upstream': (-20, 150)}, 'Columns': {'schedule': lambda i: True }, 'Rows': {'schedule': lambda i: True, 'scaling': ('scaling_const', 6.0) }, 'Motifs': {'schedule': lambda i: True, 'scaling': ('scaling_rvec', 'seq(0, 1, length=num_iterations*3/4)')}, 'MEME': {'version': '4.3.0', 'global_background': False, 'schedule': lambda i: True, 'nmotifs_rvec': 'c(rep(1, num_iterations/3), rep(2, num_iterations/3))', 'max_width': 24, 'arg_mod': 'zoops', 'background_order': 3, 'use_revcomp': 'True'}, 'Networks': {'schedule': lambda i: True, 'scaling': ('scaling_rvec', 'seq(1e-5, 0.5, length=num_iterations*3/4)')}} self.membership = self.__read_members() # relies on config_params self.iteration_result = { 'iteration': 51, 'score_means': {} }