diff --git a/tools/prodigal/Snakefile b/tools/prodigal/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..b9da10936fff84bb505f64be0b1a2831d412f92a --- /dev/null +++ b/tools/prodigal/Snakefile @@ -0,0 +1,46 @@ +""" +Prodigal manual + +Usage: prodigal [-a trans_file] [-c] [-d nuc_file] [-f output_type] + [-g tr_table] [-h] [-i input_file] [-m] [-n] [-o output_file] + [-p mode] [-q] [-s start_file] [-t training_file] [-v] + + -a: Write protein translations to the selected file. + -c: Closed ends. Do not allow genes to run off edges. + -d: Write nucleotide sequences of genes to the selected file. + -f: Select output format (gbk, gff, or sco). Default is gbk. + -g: Specify a translation table to use (default 11). + -h: Print help menu and exit. + -i: Specify FASTA/Genbank input file (default reads from stdin). + -m: Treat runs of N as masked sequence; don't build genes across them. + -n: Bypass Shine-Dalgarno trainer and force a full motif scan. + -o: Specify output file (default writes to stdout). + -p: Select procedure (single or meta). Default is single. + -q: Run quietly (suppress normal stderr output). + -s: Write all potential genes (with scores) to the selected file. + -t: Write a training file (if none exists); otherwise, read and use + the specified training file. + -v: Print version number and exit. +""" + +__prodigal_exec_command = config.get( + 'prodigal', {} +).get('exec_command', 'prodigal') +__prodigal_modules = config.get('prodigal', {}).get('modules') + +rule prodigal: + input: + __prodigal_input + output: + fasta_genes = __prodigal_fasta_genes + genes = __prodigal_genes + params: + exec_command = __prodigal_exec_command, + modules = __prodigal_modules + options = __prodigal_options + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} {params.options} -i {input} -d {output.fasta_genes} -o {output.genes}") + shell(" && ".join(command)) diff --git a/tools/prodigal/example_usage/Snakefile b/tools/prodigal/example_usage/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..7861e9224c318e3b98f136196c42759e1e95e7bf --- /dev/null +++ b/tools/prodigal/example_usage/Snakefile @@ -0,0 +1,22 @@ +configfile: "config.yaml" + +# ==== Snakefile path ==== +__prodigal_rules = config.get("snakefiles", {}).get("prodigal") + +__main_output_dir = config.get('output_dir', 'output') + +# ==== Main config ==== +SAMPLES = config.get('samples') +__input_dir = config.get('input_dir', 'data') + +# ==== Run prodigal ==== +__prodigal_output_dir = f"{__main_output_dir}/prodigal" +__prodigal_input = "{dir}/{{sample}}.fa".format(dir=__input_dir, sample="{sample}") +__prodigal_fasta_genes = "{dir}/{{sample}}.fa".format(dir=__prodigal_output_dir, sample="{sample}") +__prodigal_genes = "{dir}/{{sample}}.gbk".format(dir=__prodigal_output_dir, sample="{sample}") +include: __prodigal_rules + +rule all: + input: + fasta_genes = expand("{dir}/{{sample}}.fa".format(dir=__prodigal_output_dir), sample=SAMPLES) + genes = expand("{dir}/{{sample}}.gbk".format(dir=__prodigal_output_dir), sample=SAMPLES) diff --git a/tools/prodigal/example_usage/config.yaml b/tools/prodigal/example_usage/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3314b2d9914f22ea2a1f2ee845374147bdf236ac --- /dev/null +++ b/tools/prodigal/example_usage/config.yaml @@ -0,0 +1,14 @@ +snakefiles: + prodigal: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/tools/prodigal/Snakefile + +input_dir: /some/input/directory +output_dir: /some/output/directory + +samples: +- test_00000 +- test_00001 +- test_00002 + +prodigal: + exec_command: prodigal + modules: prodigal