generated from snakemake-workflows/snakemake-workflow-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
178 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ samples: config/samples.tsv | |
units: config/units.tsv | ||
|
||
sif_path: /public/home/rlchen/ProJect/snp_gatk/snpcalling.sif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
sample | ||
R-246 | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
sample platform fq1 fq2 | ||
R-246 ILLUMINA data/reads/R-246.1.fastq.gz data/reads/R-246.2.fastq.gz | ||
test ILLUMINA data/reads/test.1.fastq.gz data/reads/test.2.fastq.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,53 @@ | ||
rule call_variants: | ||
input: | ||
bam=get_sample_bams, | ||
bam_idx=get_sample_bams_idx, | ||
ref="resources/IRGSP-1.0_genome.fasta", | ||
fai="resources/IRGSP-1.0_genome.fasta.fai", | ||
idx="resources/IRGSP-1.0_genome.dict", | ||
output: | ||
gvcf=protected("results/called/{sample}.g.vcf.gz"), | ||
gvcf=protected("results/called/gvcfs/{sample}.g.vcf.gz"), | ||
log: | ||
"logs/gatk/haplotypecaller/{sample}.log", | ||
run: | ||
benchmark: | ||
"logs/gatk/haplotypecaller/{sample}.benchmark", | ||
shell: | ||
"gatk HaplotypeCaller -R {input.ref} -I {input.bam} -O {output.gvcf} " | ||
"-ERC GVCF" | ||
"-ERC GVCF > {log} 2>&1" | ||
|
||
|
||
rule genomics_db_import: | ||
input: | ||
gvcfs=expand("results/called/{sample}.g.vcf.gz", sample=samples.index), | ||
gvcfs=expand("results/called/gvcfs/{sample}.g.vcf.gz", sample=samples.index), | ||
output: | ||
db="results/called/genomics_db", | ||
db=directory("results/called/genome_db/{chrom}_db"), | ||
log: | ||
"logs/gatk/genomics_db_import.log", | ||
threads: 5, | ||
run: | ||
"gatk GenomicsDBImport --genomicsdb-workspace-path {output.db} " | ||
"--batch-size 100 --reader-threads {threads} {input.gvcfs}" | ||
"logs/gatk/genomics_db/genomics_db_import_{chrom}.log", | ||
benchmark: | ||
"logs/gatk/genomics_db/genomics_db_import_{chrom}.benchmark", | ||
resources: | ||
cpus_per_task=4, | ||
shell: | ||
""" | ||
gatk GenomicsDBImport --genomicsdb-workspace-path {output.db} \ | ||
--batch-size 100 --reader-threads {resources.cpus_per_task} \ | ||
-V {input.gvcfs} \ | ||
-L {wildcards.chrom} > {log} 2>&1 | ||
""" | ||
|
||
|
||
rule joint_calling: | ||
input: | ||
db="results/called/genomics_db", | ||
db="results/called/genome_db/{chrom}_db", | ||
ref="resources/IRGSP-1.0_genome.fasta", | ||
idx="resources/IRGSP-1.0_genome.dict", | ||
output: | ||
vcf="results/called/joint.vcf.gz", | ||
vcf="results/vcf/all.{chrom}.vcf.gz", | ||
log: | ||
"logs/gatk/joint_calling.log", | ||
run: | ||
"logs/gatk/joint_calling/{chrom}_joint_calling.log", | ||
benchmark: | ||
"logs/gatk/joint_calling/{chrom}_joint_calling.benchmark", | ||
shell: | ||
"gatk GenotypeGVCFs -R {input.ref} -V gendb://{input.db} " | ||
"-O {output.vcf} 2> {log}" | ||
"-O {output.vcf} 2> {log} 2>&1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
rule get_merge_list: | ||
input: | ||
expand("results/vcf/all.{chrom}.vcf.gz", chrom=CHROMOSOMES), | ||
output: | ||
"results/vcf/merge_list.txt", | ||
run: | ||
with open(output[0], "w") as f: | ||
for inp in input: | ||
f.write(inp + '\n') | ||
|
||
|
||
rule merge_vcfs: | ||
input: | ||
"results/vcf/merge_list.txt" | ||
output: | ||
"results/all.vcf.gz" | ||
log: | ||
"logs/gatk/merge_vcfs.log" | ||
benchmark: | ||
"logs/gatk/merge_vcfs.benchmark" | ||
shell: | ||
"gatk MergeVcfs -I {input} -O {output} > {log} 2>&1" | ||
|
||
rule select_snp: | ||
input: | ||
"results/all.vcf.gz" | ||
output: | ||
"results/all.snp.vcf.gz" | ||
log: | ||
"logs/gatk/select_snp.log" | ||
benchmark: | ||
"logs/gatk/select_snp.benchmark" | ||
shell: | ||
"gatk SelectVariants -V {input} -select-type SNP -O {output} > {log} 2>&1" | ||
|
||
|
||
rule filter_snp: | ||
input: | ||
vcf="results/all.snp.vcf.gz", | ||
ref="resources/IRGSP-1.0_genome.fasta" | ||
output: | ||
"results/all.snp.filter.vcf.gz" | ||
log: | ||
"logs/gatk/filter_snp.log" | ||
benchmark: | ||
"logs/gatk/filter_snp.benchmark" | ||
shell: | ||
"gatk VariantFiltration -R {input.ref} --variant {input.vcf} " | ||
"--cluster-size 3 --cluster-window-size 10 --filter-expression " | ||
"'QD<10.00' --filter-name lowQD --filter-expression 'FS>15.000' " | ||
"--filter-name highFS --genotype-filter-expression 'DP>200||DP<5' " | ||
"--genotype-filter-name InvalidDP --output {output} > {log} 2>&1" | ||
|
||
|
||
rule final_vcf: | ||
input: | ||
"results/all.snp.filter.vcf.gz" | ||
output: | ||
"results/all.snp.final.vcf.gz" | ||
log: | ||
"logs/gatk/final_vcf.log" | ||
shell: | ||
"bcftools view -f PASS {input} -Oz -o {output}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters