Exemplo n.º 1
0
 def test_motif_scoring(self):
     meme_suite = meme.MemeSuite430({'MEME': {'max_width': 24, 'background_order': 3,
                                              'use_revcomp': 'True', 'arg_mod': 'zoops'}})
     sequence_filters = [
         motif.unique_filter,
         motif.get_remove_low_complexity_filter(meme_suite),
         motif.get_remove_atgs_filter(self.search_distances['upstream'])]
     motif_scoring = motif.MemeScoringFunction(
         self.organism, self.membership, self.ratio_matrix,
         config_params=self.config_params)
     motscores = motif_scoring.compute(self.iteration_result).sorted_by_row_name()
     motscores.fix_extreme_values()
     ref_motscores = read_matrix('testdata/ref_motscores.tsv')
     self.assertTrue(check_matrix_values(motscores, ref_motscores))
Exemplo n.º 2
0
    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)