Skip to content

Commit

Permalink
feat: added variants-over-time-plot to report again (#405)
Browse files Browse the repository at this point in the history
* Added variant-plots-over-time to report

* fmt

* Correction of code in snakemake_reports

* fmt

Co-authored-by: Thomas Battenfeld <[email protected]>
  • Loading branch information
AKBrueggemann and thomasbtf authored Dec 15, 2021
1 parent 74f3077 commit bd5048a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 7 deletions.
4 changes: 3 additions & 1 deletion workflow/rules/benchmarking.smk
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ rule assembly_comparison_velvet:

rule order_contigs_assembly_comparison:
input:
contigs="results/{date}/assembly/{sample}/{assembler}-pe/{sample}.contigs.fasta",
contigs=(
"results/{date}/assembly/{sample}/{assembler}-pe/{sample}.contigs.fasta"
),
reference="resources/genomes/main.fasta",
output:
temp(
Expand Down
37 changes: 37 additions & 0 deletions workflow/rules/generate_output.smk
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,39 @@ rule plot_lineages_over_time:
"../scripts/plot-lineages-over-time.py"


rule plot_variants_over_time:
input:
bcf=lambda wildcards: expand(
"results/{date}/filtered-calls/ref~main/{sample}.subclonal.high+moderate-impact.bcf",
zip,
date=get_dates_before_date(wildcards),
sample=get_samples_before_date(wildcards),
),
csi=lambda wildcards: expand(
"results/{date}/filtered-calls/ref~main/{sample}.subclonal.high+moderate-impact.bcf.csi",
zip,
date=get_dates_before_date(wildcards),
sample=get_samples_before_date(wildcards),
),
output:
report(
"results/{date}/plots/variants-{ORFNAME}-over-time.svg",
caption="../report/variants-over-time.rst",
category="1. Overview",
subcategory="3. Variants Development",
),
"results/{date}/tables/variants-{ORFNAME}-over-time.csv",
params:
dates=get_dates_before_date,
samples=get_samples_before_date,
log:
"logs/{date}/{ORFNAME}-over-time.log",
conda:
"../envs/python.yaml"
script:
"../scripts/plot-variants-over-time.py"


rule pangolin_call_overview_csv:
input:
get_aggregated_pangolin_calls,
Expand Down Expand Up @@ -297,6 +330,10 @@ rule snakemake_reports:
# 1. Overview
"results/{date}/overview/",
"results/{date}/plots/lineages-over-time.svg",
expand(
"results/{{date}}/tables/variants-{ORFNAME}-over-time.csv",
ORFNAME=config["orf_names"],
),
"results/{date}/plots/all.strains.pangolin.svg",
"results/{date}/plots/all.major-strain.strains.kallisto.svg",
expand_samples_for_date(
Expand Down
4 changes: 3 additions & 1 deletion workflow/rules/long_read.smk
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ rule customize_primer_porechop:

rule porechop_primer_trimming:
input:
fastq_in="results/{date}/trimmed/porechop/adapter_barcode_trimming/{sample}.fastq",
fastq_in=(
"results/{date}/trimmed/porechop/adapter_barcode_trimming/{sample}.fastq"
),
repl_flag="results/.indicators/replacement_notice.txt",
output:
"results/{date}/trimmed/porechop/primer_clipped/{sample}.fastq",
Expand Down
12 changes: 9 additions & 3 deletions workflow/rules/qc.smk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ rule multiqc:
input_dirs=lambda w, input: set(path.dirname(fp) for fp in input),
output_dir=lambda w, output: path.dirname(output[0]),
output_name=lambda w, output: path.basename(output[0]),
params="--config config/multiqc_config.yaml --title 'Results for data from {date}'",
params=(
"--config config/multiqc_config.yaml --title 'Results for data from {date}'"
),
log:
"logs/{date}/multiqc.log",
conda:
Expand Down Expand Up @@ -134,7 +136,9 @@ rule species_diversity_before_pe:
kraken_output=temp(
"results/{date}/species-diversity/pe/{sample}/{sample}.kraken"
),
report="results/{date}/species-diversity/pe/{sample}/{sample}.uncleaned.kreport2",
report=(
"results/{date}/species-diversity/pe/{sample}/{sample}.uncleaned.kreport2"
),
log:
"logs/{date}/kraken/pe/{sample}.log",
params:
Expand All @@ -161,7 +165,9 @@ rule species_diversity_before_se:
kraken_output=temp(
"results/{date}/species-diversity/se/{sample}/{sample}.kraken"
),
report="results/{date}/species-diversity/se/{sample}/{sample}.uncleaned.kreport2",
report=(
"results/{date}/species-diversity/se/{sample}/{sample}.uncleaned.kreport2"
),
log:
"logs/{date}/kraken/se/{sample}.log",
threads: 8
Expand Down
4 changes: 3 additions & 1 deletion workflow/rules/read_clipping.smk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ rule samtools_sort:
output:
"results/{date}/read-sorted/{read_type}~{sorted_by}/{sample}.{stage}.bam",
params:
extra=lambda wildcards: "-n -m 4G" if wildcards.sorted_by == "name" else "-m 4G",
extra=(
lambda wildcards: "-n -m 4G" if wildcards.sorted_by == "name" else "-m 4G"
),
tmp_dir="/tmp/",
log:
"logs/{date}/sort-bam/{read_type}~{sorted_by}/{sample}.{stage}.log",
Expand Down
4 changes: 3 additions & 1 deletion workflow/rules/variant_report.smk
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ rule ucsc_vcf:
bcfs=get_report_input(
"results/{date}/filtered-calls/ref~main/{sample}.subclonal.{filter}.bcf"
),
strain_call="results/{date}/tables/strain-calls/{target}.polished.strains.pangolin.csv",
strain_call=(
"results/{date}/tables/strain-calls/{target}.polished.strains.pangolin.csv"
),
output:
report(
"results/{date}/ucsc-vcfs/{target}.{filter}.vcf",
Expand Down

0 comments on commit bd5048a

Please sign in to comment.