Skip to content

Commit 02094c9

Browse files
Update organize.py
1 parent 65c0115 commit 02094c9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cosigt_smk/workflow/scripts/organize.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def main():
101101
additional.add_argument('--output', help='output folder [results]', metavar='FOLDER', default='results')
102102
additional.add_argument('--profile', help='use profile. If None, do not use profile and run on the local machine [config/slurm]', metavar='FOLDER', default='config/slurm')
103103
additional.add_argument('--samplemap', help='tsv file mapping each bam/cram basename to a user-defined id. If None, infer from bam/cram basename [None]', metavar='TSV', type=str, default=None)
104+
additional.add_argument('--threads', help='Number of max concurrent cores for snakemake if no profile is provided (ignored otherwise) [1]', type=int, default=1)
104105
#metrics
105106
metrics = parser.add_argument_group('Specify #threads, memory and time requirements')
106107
metrics.add_argument('--std_time', help='max time (minutes) - default [1]',type=int, default=1)
@@ -229,20 +230,20 @@ def main():
229230
os.remove(out_yaml_tmp)
230231
#write command - singularity
231232
singpath=','.join(list(set([os.path.abspath(args.alignments),os.path.dirname(os.path.abspath(args.assemblies)), os.path.dirname(os.path.abspath(args.reference)),args.binds, os.path.abspath(args.pggb_tmpdir), os.path.abspath(args.wfmash_tmpdir)])))
232-
if args.profile is not None:
233+
if args.profile is not "None":
233234
command_singularity_out='SINGULARITY_TMPDIR=' + os.path.abspath(args.tmp) + ' snakemake --profile ' + args.profile + ' --singularity-args "-B '+ singpath + ' -e" cosigt'
234235
with open('snakemake.singularity.profile.run.sh', 'w') as out:
235236
out.write(command_singularity_out + '\n')
236237
#write command - conda
237-
command_conda_out='snakemake --profile ' + args.profile + ' --use-conda cosigt'
238+
command_conda_out='snakemake --profile ' + args.profile + ' cosigt'
238239
with open('snakemake.conda.profile.run.sh', 'w') as out:
239240
out.write(command_conda_out + '\n')
240241
else:
241-
command_singularity_out='SINGULARITY_TMPDIR=' + os.path.abspath(args.tmp) + ' snakemake --singularity-args "-B '+ singpath + ' -e" cosigt'
242+
command_singularity_out='SINGULARITY_TMPDIR=' + os.path.abspath(args.tmp) + ' snakemake --use-singularity --singularity-args "-B '+ singpath + ' -e" -j ' + str(args.threads) + ' cosigt'
242243
with open('snakemake.singularity.run.sh', 'w') as out:
243244
out.write(command_singularity_out + '\n')
244245
#write command - conda
245-
command_conda_out='snakemake --use-conda cosigt'
246+
command_conda_out='snakemake --use-conda -j ' + str(args.threads) + ' cosigt'
246247
with open('snakemake.conda.run.sh', 'w') as out:
247248
out.write(command_conda_out + '\n')
248249

0 commit comments

Comments
 (0)