nestly是一个函数集合,旨在使运行中的软件更容易选择参数。
nestl的Python项目详细描述
nestly是一组函数,旨在通过组合参数的选择来简化软件的运行。 对于参数选择的“笛卡尔积”,它可以很容易地做到这一点,但是可以做得更多——可以使用任意的“向后看”依赖项。
这里的设想是,我们取一组固定的参数,并为每个定义的组合生成一种类型的输出,然后以某种方式组合以进行比较和检索。 我们希望为反映嵌套参数选择的输出设置整齐的嵌套目录。
full documentation在readthedocs上可用。
安装
最简单的方法是使用pip:
$ pip install nestly
或者,对于master的最新提交:
$ pip install git+git://github.com/fhcrc/nestly.git@master
Python2.7是必需的。
介绍性示例
假设您想尝试以下所有可能的组合:
Option | Choices |
strategy | approximate, exhaustive |
run_count | 10, 100, 1000 |
input file | any file matching inputs/file* |
为此,我们可以写一点make_nest.py。勇气是:
nest = Nest() nest.add('strategy', ('exhaustive', 'approximate')) nest.add('run_count', [10**i for i in xrange(3)]) nest.add('input_file', glob.glob(os.path.join(input_dir, 'file*')), label_func=os.path.basename) nest.build('runs')
运行make_nest.py,您将得到如下目录树:
runs ├── approximate │ ├── 10 │ │ ├── file1 │ │ │ └── control.json │ │ ├── file2 │ │ └── control.json │ ├── 100 │ │ ├── file1 │ │ │ └── control.json │ │ ├── file2 │ │ └── control.json │ └── 1000 │ ├── file1 │ │ └── control.json │ ├── file2 │ └── control.json └── exhaustive ├── 10 │ ├── file1 │ │ └── control.json │ ├── file2 │ └── control.json ├── 100 │ ├── file1 │ │ └── control.json │ ├── file2 │ └── control.json └── 1000 ├── file1 │ └── control.json ├── file2 └── control.json
最后的control.json读数,例如:
{ "input_file": "/Users/cmccoy/Development/nestly/examples/basic_nest/inputs/file3", "run_count": "1000", "strategy": "exhaustive" }
然后创建的控制文件作为模板子副本的nestrun的输入,例如:
nestrun --save-cmd-file command.sh \ --template='my_command -s {strategy} --count={run_count} {input_file}' \ $(find runs -name "control.json")
此命令在所有tip目录中使用参数的适当值运行my_command。
这是一个“笛卡尔产品”的例子。 存储库中的“meal”示例展示了一个在嵌套之间具有更复杂依赖关系的设置。
模板
nestrun接受一个模板和一个包含变量的control.json文件列表 替代品。默认情况下,替换是使用python内置的 str.format方法。有关语法的详细信息,请参见Python Formatter documentation, 以examples/jsonrun/do_nestrun.sh为例。
SCONS集成
还有一个nestly.scons模块要与make替换SCons嵌套集成。
纸张
McCoy Co,Gallagher A,Hoffman Ng,Matsen Fa(2013)Nestly–一个运行具有嵌套参数选择和聚合结果的软件的框架。生物信息学29:387-388。pubmed
许可证
nestly源代码在MIT License下免费提供。