1
1
#!/usr/bin/env python
2
# Author: Greg Caporaso (gregcaporaso@gmail.com)
2
# File created on 13 Jul 2012
5
3
from __future__ import division
6
from os.path import split, splitext
7
from qiime.parallel.util import get_rename_command
9
5
__author__ = "Greg Caporaso"
10
__copyright__ = "Copyright 2011, The QIIME Project"
11
__credits__ = ["Greg Caporaso","Justin Kuczynski"]
6
__copyright__ = "Copyright 2011, The QIIME project"
7
__credits__ = ["Greg Caporaso"]
14
10
__maintainer__ = "Greg Caporaso"
15
11
__email__ = "gregcaporaso@gmail.com"
16
12
__status__ = "Release"
18
def get_job_commands(python_exe_fp,alpha_diversity_fp,tree_fp,job_prefix,\
19
metrics,input_fps,output_dir,working_dir,\
20
command_prefix=None,command_suffix=None):
21
"""Generate alpha diversity commands to be submitted to cluster
24
command_prefix = command_prefix or '/bin/bash; '
25
command_suffix = command_suffix or '; exit'
30
for input_fp in input_fps:
31
input_path, input_fn = split(input_fp)
32
output_fn = 'alpha_%s' % input_fn
33
rename_command, current_result_filepaths = get_rename_command(\
34
[output_fn],working_dir,output_dir)
35
result_filepaths += current_result_filepaths
37
command = '%s %s %s -i %s -o %s -t %s -m %s %s %s' %\
42
working_dir + '/' + output_fn,
14
from os.path import join, split
15
from qiime.parallel.util import ParallelWrapper
17
class ParallelAlphaDiversity(ParallelWrapper):
18
_script_name = "alpha_diversity.py"
20
_input_splitter = ParallelWrapper._input_existing_filepaths
22
def _identify_files_to_remove(self,job_result_filepaths,params):
23
""" The output of the individual jobs are the files we want to keep
27
def _get_job_commands(self,
33
command_prefix='/bin/bash; ',
34
command_suffix='; exit'):
35
"""Generate alpha diversity commands to be submitted to cluster
40
if params['tree_path']:
41
tree_str = '-t %s' % params['tree_path']
45
for input_fp in input_fps:
46
input_path, input_fn = split(input_fp)
47
output_fn = 'alpha_%s' % input_fn
48
output_fn = output_fn.replace('.biom','.txt')
49
temp_fp = join(working_dir,output_fn)
50
rename_command, current_result_filepaths =\
51
self._get_rename_command([output_fn],working_dir,output_dir)
52
result_filepaths += current_result_filepaths
54
command = '%s %s -i %s -o %s %s -m %s %s %s' %\
48
commands.append(command)
50
return commands, result_filepaths
64
commands.append(command)
66
commands = self._merge_to_n_commands(commands,
67
params['jobs_to_start'],
68
command_prefix=command_prefix,
69
command_suffix=command_suffix)
71
return commands, result_filepaths
b'\\ No newline at end of file'