Skip to content

Commit

Permalink
adaptations for snakedeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
tlenfers committed Mar 28, 2022
1 parent 9fb676e commit addf307
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ cython_debug/
# Built Visual Studio Code Extensions
*.vsix

workflow/data/reference/*
workflow/{{reference_path}}/*
workflow/data/samples/*
!workflow/data/samples/readme_samples.md

Expand All @@ -167,3 +167,4 @@ workflow/results/*
results/*
.idea/
config/config.yaml
data/*
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ source activate wf
**Samples:**

- Put all sample names in a single column in [`samples.tsv`](/config/samples.tsv).
- Put all sample files in `workflow/data/samples/`
- Add the data folder to [`config.yaml`](config/config.yaml) where all files to be analysed are located
- standard path is set to `data/`
- assumed naming convention:
- sampleName_R1.fastq.gz
- sampleName_R2.fastq.gz
Expand Down
6 changes: 5 additions & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# path or URL to sample sheet (TSV format, columns: sample)
sample_file: config/samples.tsv
# path to samples
data_path : data
# species of the samples and reference genome (dog, human, mouse)
reference: ""
# reference file expected to be named as such: species.fa
reference: "human"
reference_path: "workflow/results/reference"
9 changes: 7 additions & 2 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ from pathlib import Path


##### setup config #####
configfile: "../config/config.yaml"
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()

data_path = Path(config["data_path"])

reference_path = Path(config["reference_path"])


##### load rules #####
include: "rules/reference.smk"
Expand Down
12 changes: 6 additions & 6 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="data/reference/{reference}.fa.amb",
ref="data/reference/{reference}.fa",
fastq_r1="data/samples/{sample}_R1.fastq.gz",
fastq_r2="data/samples/{sample}_R2.fastq.gz",
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",
wildcard_constraints:
reference="[A-Za-z0-9]+",
output:
Expand Down Expand Up @@ -36,9 +36,9 @@ rule idx_bam:
# creates index for the reference sequence in fasta format
rule idx_fasta:
input:
"data/reference/{reference}.fa",
"{{reference_path}}/{reference}.fa",
output:
"data/reference/{reference}.fa.fai",
"{{reference_path}}/{reference}.fa.fai",
conda:
"../envs/samtools.yaml"
log:
Expand Down
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="data/reference/{reference}.fa",
ref="{{reference_path}}/{reference}.fa",
vcf="results/sequences/{caller}/{reference}/{sample}.vcf.gz",
index="results/sequences/{caller}/{reference}/{sample}.vcf.gz.tbi",
output:
Expand Down
14 changes: 7 additions & 7 deletions workflow/rules/reference.smk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# downloading the mitochondrial reference genome for mouse, dog and human data
rule get_ref:
output:
"data/reference/{reference}.fa",
"{{reference_path}}/{reference}.fa",
log:
"logs/{reference}/get_ref.log",
run:
Expand All @@ -22,13 +22,13 @@ rule get_ref:
# creates the index for the reference genome
rule bwa_idx:
input:
"data/reference/{reference}.fa",
"{{reference_path}}/{reference}.fa",
output:
"data/reference/{reference}.fa.amb",
"data/reference/{reference}.fa.ann",
"data/reference/{reference}.fa.bwt",
"data/reference/{reference}.fa.pac",
"data/reference/{reference}.fa.sa",
"{{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",
wildcard_constraints:
reference="[A-Za-z0-9]+",
conda:
Expand Down
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="data/reference/{reference}.fa",
index="data/reference/{reference}.fa.fai",
ref="{{reference_path}}/{reference}.fa",
index="{{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="data/reference/{reference}.fa",
ref="{{reference_path}}/{reference}.fa",
output:
"results/calls_bcftools/{reference}/norm_{sample}.vcf",
conda:
Expand Down
4 changes: 2 additions & 2 deletions workflow/rules/variants_mutserve.smk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ rule mutserve:
input:
bam="results/mapped/{reference}/{sample}.bam",
bamidx="results/mapped/{reference}/{sample}.bam.bai",
ref="data/reference/{reference}.fa",
index="data/reference/{reference}.fa.fai",
ref="{{reference_path}}/{reference}.fa",
index="{{reference_path}}/{reference}.fa.fai",
output:
"results/calls_mutserve/{reference}/{sample}.vcf",
wildcard_constraints:
Expand Down

0 comments on commit addf307

Please sign in to comment.