当前位置: 首页>>代码示例>>Python>>正文


Python MotifConfig.set_motif_dir方法代码示例

本文整理汇总了Python中gimmemotifs.config.MotifConfig.set_motif_dir方法的典型用法代码示例。如果您正苦于以下问题:Python MotifConfig.set_motif_dir方法的具体用法?Python MotifConfig.set_motif_dir怎么用?Python MotifConfig.set_motif_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gimmemotifs.config.MotifConfig的用法示例。


在下文中一共展示了MotifConfig.set_motif_dir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from gimmemotifs.config import MotifConfig [as 别名]
# 或者: from gimmemotifs.config.MotifConfig import set_motif_dir [as 别名]
    def run(self):
        from gimmemotifs.config import MotifConfig
        
        cfg = MotifConfig(use_config=self.build_cfg)

        data_dir = self.remove_nonsense(os.path.abspath(self.install_dir))
        
        cfg.set_template_dir(os.path.join(data_dir, 'gimmemotifs/templates'))
        cfg.set_gene_dir(os.path.join(data_dir, 'gimmemotifs/genes'))
        cfg.set_score_dir(os.path.join(data_dir, 'gimmemotifs/score_dists'))
        cfg.set_index_dir(os.path.join(data_dir, 'gimmemotifs/genome_index'))
        cfg.set_motif_dir(os.path.join(data_dir, 'gimmemotifs/motif_databases'))
        cfg.set_bg_dir(os.path.join(data_dir, 'gimmemotifs/bg'))
        cfg.set_tools_dir(os.path.join(data_dir, 'gimmemotifs/tools'))
        
        final_tools_dir = self.remove_nonsense(self.install_tools_dir)
        for program in MOTIF_CLASSES:
            m = eval(program)()
            if cfg.is_configured(m.name):
                bin = cfg.bin(m.name).replace(self.build_tools_dir, final_tools_dir) 
                dir = cfg.dir(m.name)
                if dir:
                    dir = dir.replace(self.build_tools_dir, final_tools_dir)
                cfg.set_program(m.name, {"bin":bin, "dir":dir})
            
        dir = cfg.get_seqlogo()
        dir = dir.replace(self.build_tools_dir, final_tools_dir)
        cfg.set_seqlogo(dir)

        # Use a user-specific configfile if any other installation scheme is used
#        if os.path.abspath(self.install_dir) == "/usr/share":
        config_file = os.path.join(self.install_dir, "gimmemotifs/%s" % CONFIG_NAME)
        self.outfiles = [config_file] 


        if os.path.exists(config_file):
            new_config = config_file + ".tmp"
            dlog.info("INFO: Configfile %s already exists!" % config_file)
            dlog.info("INFO: Will create %s, which contains the new config." % new_config)
            dlog.info("INFO: If you want to use the newly generated config you can move %s to %s, otherwise you can delete %s.\n" % (new_config, config_file, new_config))

            f =  open(new_config, "wb")
            cfg.write(f)
        else: 
            dlog.info("writing configuration file %s" % config_file)
            f =  open(config_file, "wb")
            cfg.write(f)
        
        if os.path.abspath(self.install_dir) != "/usr/share":
            dlog.info("PLEASE NOTE: GimmeMotifs is installed in a non-standard location.")
            dlog.info("PLEASE NOTE: This is fine, but then every user should have a file called ~/.gimmemotifs.cfg")
            dlog.info("PLEASE NOTE: The file %s is fully configured during install and can be used for that purpose." % config_file)
开发者ID:georgeg9,项目名称:gimmemotifs,代码行数:54,代码来源:setup.py

示例2: run

# 需要导入模块: from gimmemotifs.config import MotifConfig [as 别名]
# 或者: from gimmemotifs.config.MotifConfig import set_motif_dir [as 别名]
    def run(self):
        from gimmemotifs.config import MotifConfig
        
        cfg = MotifConfig(use_config=self.build_cfg)

        data_dir = self.remove_nonsense(os.path.abspath(self.install_dir))
        
        cfg.set_template_dir(os.path.join(data_dir, 'gimmemotifs/templates'))
        cfg.set_gene_dir(os.path.join(data_dir, 'gimmemotifs/genes'))
        cfg.set_score_dir(os.path.join(data_dir, 'gimmemotifs/score_dists'))
        cfg.set_index_dir(os.path.join(data_dir, 'gimmemotifs/genome_index'))
        cfg.set_motif_dir(os.path.join(data_dir, 'gimmemotifs/motif_databases'))
        cfg.set_bg_dir(os.path.join(data_dir, 'gimmemotifs/bg'))
        cfg.set_tools_dir(os.path.join(data_dir, 'gimmemotifs/tools'))
        
        final_tools_dir = self.remove_nonsense(self.install_tools_dir)
        for program in MOTIF_CLASSES:
            m = eval(program)()
            if cfg.is_configured(m.name):
                bin = cfg.bin(m.name).replace(self.build_tools_dir, final_tools_dir) 
                dir = cfg.dir(m.name)
                if dir:
                    dir = dir.replace(self.build_tools_dir, final_tools_dir)
                cfg.set_program(m.name, {"bin":bin, "dir":dir})
            
        dir = cfg.get_seqlogo()
        dir = dir.replace(self.build_tools_dir, final_tools_dir)
        cfg.set_seqlogo(dir)

        # Use a user-specific configfile if any other installation scheme is used
#        if os.path.abspath(self.install_dir) == "/usr/share":
        config_file = os.path.join(self.install_dir, "gimmemotifs/%s" % CONFIG_NAME)
        self.outfiles = [config_file] 

        if os.path.exists(config_file):
            timestr = time.strftime("%Y%m%d-%H%M%S")        
            old_config = "{}.{}".format(config_file, timestr)
            shutil.move(config_file, old_config)
            dlog.info("INFO: Configfile %s already existed!", config_file)
            dlog.info("INFO: This config has been saved as %s", old_config)
         
        dlog.info("writing configuration file %s" % config_file)
        f =  open(config_file, "wb")
        cfg.write(f)
开发者ID:YichaoOU,项目名称:gimmemotifs,代码行数:46,代码来源:setup.py

示例3: write_config

# 需要导入模块: from gimmemotifs.config import MotifConfig [as 别名]
# 或者: from gimmemotifs.config.MotifConfig import set_motif_dir [as 别名]
	def write_config(self):
		from gimmemotifs.config import MotifConfig
		cfg = MotifConfig(use_config="cfg/gimmemotifs.cfg.example")

		data_dir = os.path.abspath(self.install_data)
		cfg.set_template_dir(os.path.join(data_dir, 'gimmemotifs/templates'))
		cfg.set_gene_dir(os.path.join(data_dir, 'gimmemotifs/genes'))
		cfg.set_score_dir(os.path.join(data_dir, 'gimmemotifs/score_dists'))
		cfg.set_index_dir(os.path.join(data_dir, 'gimmemotifs/genome_index'))
		cfg.set_motif_dir(os.path.join(data_dir, 'gimmemotifs/motif_databases'))
		cfg.set_bg_dir(os.path.join(data_dir, 'gimmemotifs/bg'))
		
		print 
		print "Trying to locate motif programs"
		
		MOTIF_CLASSES = ["MDmodule", "Meme", "Weeder", "Gadem", "MotifSampler", "Trawler", "Improbizer", "MoAn", "BioProspector"]
		available = []
		for program in MOTIF_CLASSES:
			m = eval(program)()
			cmd = m.cmd
			bin = which(cmd)
			if bin:
				print "Found %s in %s" % (m.name, bin)
				available.append(m.name)
				dir = None
				if program == "Weeder":
					dir = bin.replace("weederTFBS.out","")
				elif program == "Meme":
					dir = bin.replace("bin/meme", "")
				elif program == "Trawler":
					dir = bin.replace("bin/trawler.pl", "")
		
				cfg.set_program(m.name, {"bin":bin, "dir":dir})
			else:
				print "Couldn't find %s" % m.name
		
		print
		print "Trying to locate seqlogo"
		bin = which("seqlogo")
		if bin:
			print "Found seqlogo in %s" % (bin)
			cfg.set_seqlogo(bin)
		else:
			print "Couldn't find seqlogo"
		print
		
		DEFAULT_PARAMS["available_tools"] = ",".join(available)
		DEFAULT_PARAMS["tools"] = ",".join(available)
		cfg.set_default_params(DEFAULT_PARAMS)
		
		# Use a user-specific configfile if any other installation scheme is used
		if os.path.abspath(self.install_data) == "/usr/share":
			config_file = "/usr/share/gimmemotifs/%s" % CONFIG_NAME
		else:
			config_file = os.path.expanduser("~/.%s" % CONFIG_NAME)
		
		if os.path.exists(config_file):
			new_config = config_file + ".tmp"
			print "INFO: Configfile %s already exists!\n      Will create %s, which contains the new config.\n      If you want to use the newly generated config you can move %s to %s, otherwise you can delete %s.\n" % (config_file, new_config, new_config, config_file, new_config)

			f =  open(new_config, "wb")
			cfg.write(f)
		else: 
			print "Writing configuration file %s" % config_file
			f =  open(config_file, "wb")
			cfg.write(f)
		
		print "Edit %s to further configure GimmeMotifs." % config_file
开发者ID:astatham,项目名称:gimmemotifs,代码行数:70,代码来源:setup.py


注:本文中的gimmemotifs.config.MotifConfig.set_motif_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。