Skip to content

Commit

Permalink
snakemake deploy adaptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tim lenfers committed Mar 28, 2022
1 parent 90b4f2d commit 02bc9c1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from pathlib import Path
configfile: "config/config.yaml"


#sample_file = Path.joinpath(Path(".."), Path(config["sample_file"]))
# sample_file = Path.joinpath(Path(".."), Path(config["sample_file"]))
sample_file = Path(config["sample_file"])
samples = read_table(sample_file)["sample_name"].tolist()

Expand Down
4 changes: 0 additions & 4 deletions workflow/data/samples/readme_samples.md

This file was deleted.

16 changes: 8 additions & 8 deletions workflow/rules/align.smk
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# mapping of the reads to the reference genome using Burrows-Wheeler Aligner
rule bwa_mem:
input:
amb="{{reference_path}}/{reference}.fa.amb",
ref="{{reference_path}}/{reference}.fa",
fastq_r1="{{data_path}}/{sample}_R1.fastq.gz",
fastq_r2="{{data_path}}/{sample}_R2.fastq.gz",
amb = Path.joinpath(Path(config["reference_path"]), "{reference}.fa.amb"),
ref = Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
fastq_r1=Path.joinpath(Path(config["data_path"]), "{sample}_R1.fastq.gz"),
fastq_r2=Path.joinpath(Path(config["data_path"]), "{sample}_R2.fastq.gz"),
wildcard_constraints:
reference="[A-Za-z0-9]+",
output:
Expand Down Expand Up @@ -36,12 +36,12 @@ rule idx_bam:
# creates index for the reference sequence in fasta format
rule idx_fasta:
input:
"{{reference_path}}/{reference}.fa",
Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
output:
"{{reference_path}}/{reference}.fa.fai",
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.fai"),
conda:
"../envs/samtools.yaml"
log:
"logs/{{reference_path}}/{reference}/idx_fasta.log",
#log:
# "logs/{{reference_path}}/{reference}/idx_fasta.log",
shell:
"samtools faidx {input}"
2 changes: 1 addition & 1 deletion workflow/rules/consensus_sequence.smk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rule prepare_for_seq:
# creates the consensus sequence
rule vcf_to_fasta:
input:
ref="{{reference_path}}/{reference}.fa",
ref=Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
vcf="results/sequences/{caller}/{reference}/{sample}.vcf.gz",
index="results/sequences/{caller}/{reference}/{sample}.vcf.gz.tbi",
output:
Expand Down
22 changes: 11 additions & 11 deletions workflow/rules/reference.smk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# downloading the mitochondrial reference genome for mouse, dog and human data
rule get_ref:
output:
"{{reference_path}}/{reference}.fa",
log:
"logs/{{reference_path}}/{reference}/get_ref.log",
Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
#log:
# "logs/{{reference_path}}/{reference}/get_ref.log",
run:
if config["reference"] == "mouse":
shell(
Expand All @@ -22,18 +22,18 @@ rule get_ref:
# creates the index for the reference genome
rule bwa_idx:
input:
"{{reference_path}}/{reference}.fa",
Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
output:
"{{reference_path}}/{reference}.fa.amb",
"{{reference_path}}/{reference}.fa.ann",
"{{reference_path}}/{reference}.fa.bwt",
"{{reference_path}}/{reference}.fa.pac",
"{{reference_path}}/{reference}.fa.sa",
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.amb"),
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.ann"),
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.bwt"),
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.pac"),
Path.joinpath(Path(config["reference_path"]), "{reference}.fa.sa"),
wildcard_constraints:
reference="[A-Za-z0-9]+",
conda:
"../envs/bwa.yaml"
log:
"logs/{{reference_path}}/{reference}/bwa_idx.log",
#log:
# "logs/{{reference_path}}/{reference}/bwa_idx.log",
shell:
"bwa index {input}"
6 changes: 3 additions & 3 deletions workflow/rules/variants_bcftools.smk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ rule call_variants:
input:
bam="results/mapped/{reference}/{sample}.bam",
bamidx="results/mapped/{reference}/{sample}.bam.bai",
ref="{{reference_path}}/{reference}.fa",
index="{{reference_path}}/{reference}.fa.fai",
ref = Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
index = Path.joinpath(Path(config["reference_path"]), "{reference}.fa.fai"),
output:
"results/calls_bcftools/{reference}/{sample}.vcf",
wildcard_constraints:
Expand All @@ -24,7 +24,7 @@ rule call_variants:
rule normalize_variants:
input:
vcf="results/calls_bcftools/{reference}/{sample}.vcf.gz",
ref="{{reference_path}}/{reference}.fa",
ref = Path.joinpath(Path(config["reference_path"]), "{reference}.fa"),
output:
"results/calls_bcftools/{reference}/norm_{sample}.vcf",
conda:
Expand Down

0 comments on commit 02bc9c1

Please sign in to comment.