From 42a636ce218d83255301cef066a7963f4e51be0e Mon Sep 17 00:00:00 2001 From: Till Hartmann Date: Wed, 14 Sep 2022 12:32:33 +0000 Subject: [PATCH 1/3] move annotation header extraction params to common.smk --- workflow/rules/annotate.smk | 9 +++------ workflow/rules/common.smk | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/workflow/rules/annotate.smk b/workflow/rules/annotate.smk index 057d7fb1..c2c461be 100644 --- a/workflow/rules/annotate.smk +++ b/workflow/rules/annotate.smk @@ -1,6 +1,3 @@ -CYRCULAR_INFO_FIELDS = ["CircleLength", "CircleSegmentCount", "SplitReads", "Support"] - - rule extract_vcf_header_lines_for_bcftools_annotate: input: vcf="results/calling/candidates/{sample}.sorted.bcf", @@ -39,9 +36,9 @@ rule copy_annotation_from_cyrcular: conda: "../envs/vcf_annotate.yaml" params: - header="CHROM,POS,ID,REF,ALT," + ",".join(CYRCULAR_INFO_FIELDS), - table_expr="CHROM,POS,ID,REF,ALT," + ",".join(map(lambda s: "INFO['" + s + "']", CYRCULAR_INFO_FIELDS)), - columns="CHROM,POS,~ID,REF,ALT," + ",".join(CYRCULAR_INFO_FIELDS), + header=copy_annotation_vembrane_header_expr(), + table_expr=copy_annotation_table_expr(), + columns=copy_annotation_bcftools_annotate_columns(), shell: """ vembrane table --header {params.header:q} {params.table_expr:q} {input.candidates_with_annotation} > {output.annotation} 2> {log} diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index 1a27803e..de0d6f17 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -257,3 +257,21 @@ BND_RE = re.compile(r""".*([]\[])((?P.+):(?P[0-9]+))([]\[])?. def parse_bnd_alt(s: str): return BND_RE.search(s)["seqname"], int(BND_RE.search(s)["position"]) + + +## rules/annotation.smk specific +CYRCULAR_INFO_FIELDS = ["CircleLength", "CircleSegmentCount", "SplitReads", "Support"] + + +def copy_annotation_table_expr(): + return "CHROM,POS,ID,REF,ALT," + ",".join( + map(lambda s: f"INFO['{s}']", CYRCULAR_INFO_FIELDS) + ) + + +def copy_annotation_vembrane_header_expr(): + return "CHROM,POS,ID,REF,ALT," + ",".join(CYRCULAR_INFO_FIELDS) + + +def copy_annotation_bcftools_annotate_columns(): + return "CHROM,POS,~ID,REF,ALT," + ",".join(CYRCULAR_INFO_FIELDS) From 98dff14f999b7f13f3fa926dd708c0f5f4f20b24 Mon Sep 17 00:00:00 2001 From: Till Hartmann Date: Wed, 14 Sep 2022 12:32:57 +0000 Subject: [PATCH 2/3] add missing conda env and log directives --- workflow/rules/datavzrd.smk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/workflow/rules/datavzrd.smk b/workflow/rules/datavzrd.smk index 06deaea9..3e3c9975 100644 --- a/workflow/rules/datavzrd.smk +++ b/workflow/rules/datavzrd.smk @@ -26,11 +26,15 @@ rule copy_qc_plots_for_datavzrd: output_dir=lambda wc: directory( f"results/datavzrd-report/all.fdr-controlled/circles-{wc.group}/qc_plots" ), + log: + "logs/datavzrd/copy_qc_plots/{group}.log", + conda: + "../envs/bash.yaml" shell: """ - mkdir -p {params.output_dir} + mkdir -p {params.output_dir} 2> {log} for f in `find {input.plots} -regex '.*/graph_[0-9]+_[0-9]+\.html'`; do ( cp "$f" {params.output_dir} ); done - touch {output.marker} + touch {output.marker} 2>> {log} """ @@ -44,6 +48,10 @@ rule copy_graph_plots_for_datavzrd: output_dir=lambda wc: directory( f"results/datavzrd-report/all.fdr-controlled/circles-{wc.group}/graphs" ), + log: + "logs/datavzrd/copy_graph_plots/{group}.log", + conda: + "../envs/bash.yaml" shell: """ mkdir -p {params.output_dir} From 5be61ca7c6bfd9d9c6681d7c4fc6d0c9c97c035c Mon Sep 17 00:00:00 2001 From: Till Hartmann Date: Wed, 14 Sep 2022 12:33:38 +0000 Subject: [PATCH 3/3] add bash conda env --- workflow/envs/bash.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 workflow/envs/bash.yaml diff --git a/workflow/envs/bash.yaml b/workflow/envs/bash.yaml new file mode 100644 index 00000000..e32d4a8b --- /dev/null +++ b/workflow/envs/bash.yaml @@ -0,0 +1,4 @@ +channels: + - conda-forge +dependencies: + - bash =5.1