@@ -3,15 +3,17 @@ rule contig_annotate__camper__annotate:
33 input :
44 fa = CONTIG_PRODIGAL / "{assembly_id}/{assembly_id}.prodigal.fa" ,
55 output :
6- annotation = directory (CONTIG_CAMPER / "{assembly_id}" )
6+ annotation = CONTIG_CAMPER / "{assembly_id}" / "annotations.tsv" ,
7+ distillate = CONTIG_CAMPER / "{assembly_id}" / "distillate.tsv" ,
78 log :
89 CONTIG_CAMPER / "{assembly_id}.log" ,
910 conda :
1011 "__environment__.yml"
1112 container :
1213 docker ["camper" ]
1314 params :
14- out_dir = CAMPER ,
15+ camper_dir = CONTIG_CAMPER ,
16+ out_dir = lambda wildcards : f"{ CONTIG_CAMPER } /{ wildcards .assembly_id } " ,
1517 camper_db = features ["databases" ]["camper" ],
1618 nvme = config ["nvme_storage" ],
1719 threads : config ["resources" ]["cpu_per_task" ]["multi_thread" ]
@@ -26,24 +28,29 @@ rule contig_annotate__camper__annotate:
2628 cp {params.camper_db}/* {params.nvme} \
2729 2>> {log} 1>&2
2830
31+ tmpdir={params.out_dir}/tmp
32+
2933 camper_annotate -i {input} \
30- -o {output} \
34+ -o $tmpdir \
3135 --threads {threads} \
3236 --camper_fa_db_loc {params.nvme}/CAMPER_blast.faa \
33- --camper_fa_db_cutoffs_loc {params.nvme}/CAMPER_blast_scores.tsv \
34- --camper_hmm_loc {params.nvme}/CAMPER.hmm \
37+ --camper_fa_db_cutoffs_loc {params.nvme}/CAMPER_blast_scores.tsv \
38+ --camper_hmm_loc {params.nvme}/CAMPER.hmm \
3539 --camper_hmm_cutoffs_loc {params.nvme}/CAMPER_hmm_scores.tsv \
3640 2>> {log} 1>&2
3741
38- camper_distill -a {output} /annotations.tsv \
39- -o {output}/distillate.tsv \
40- --camper_distillate {params.nvme}/CAMPER_distillate.tsv \
42+ camper_distill -a $tmpdir /annotations.tsv \
43+ -o {output.distillate} \
44+ --camper_distillate {params.nvme}/CAMPER_distillate.tsv \
4145 2>> {log} 1>&2
4246
47+ # Move all tmp files one level up
48+ mv "$tmpdir"/* {params.out_dir}/
49+
4350 """
4451
4552
4653rule contig_annotate__camper :
4754 """Run CAMPER on contig gene sequences."""
4855 input :
49- [CONTIG_CAMPER / f"{ assembly_id } " for assembly_id in ASSEMBLIES ],
56+ [CONTIG_CAMPER / f"{ assembly_id } " / "annotations.tsv" for assembly_id in ASSEMBLIES ],
0 commit comments