Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Jan 20, 2022
0 parents commit 6697b53
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[![Binder](https://binder.pangeo.io/badge_logo.svg)](https://binder.pangeo.io/v2/gh/ngs-docs/2022-ggg-201b-variant-calling/stable?urlpath=rstudio)
59 changes: 59 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# default rule that tells snakemake to create the .vcf file if
# it is not run with any specific rule or file request.
rule all:
input:
"SRR2584857_1.ecoli-rel606.vcf"

rule download_data:
conda: "env-wget.yml"
output: "SRR2584857_1.fastq.gz"
shell: """
wget https://osf.io/4rdza/download -O {output}
"""

rule download_genome:
conda: "env-wget.yml"
output: "ecoli-rel606.fa.gz"
shell:
"wget https://osf.io/8sm92/download -O {output}"

rule map_reads:
conda: "env-minimap.yml"
input: ref="ecoli-rel606.fa.gz", reads="SRR2584857_1.fastq.gz"
output: "SRR2584857_1.ecoli-rel606.sam"
shell: """
minimap2 -ax sr {input.ref} {input.reads} > {output}
"""

rule sam_to_bam:
conda: "env-minimap.yml"
input: "SRR2584857_1.ecoli-rel606.sam"
output: "SRR2584857_1.ecoli-rel606.bam"
shell: """
samtools view -b -F 4 {input} > {output}
"""

rule sort_bam:
conda: "env-minimap.yml"
input: "SRR2584857_1.ecoli-rel606.bam"
output: "SRR2584857_1.ecoli-rel606.bam.sorted"
shell: """
samtools sort {input} > {output}
"""

rule call_variants:
conda: "env-bcftools.yml"
input:
ref="ecoli-rel606.fa.gz",
bamsort="SRR2584857_1.ecoli-rel606.bam.sorted"
output:
refout="ecoli-rel606.fa",
pileup="SRR2584857_1.ecoli-rel606.pileup",
bcf="SRR2584857_1.ecoli-rel606.bcf",
vcf="SRR2584857_1.ecoli-rel606.vcf"
shell: """
gunzip -c {input.ref} > {output.refout}
bcftools mpileup -Ou -f {output.refout} {input.bamsort} > {output.pileup}
bcftools call -mv -Ob {output.pileup} -o {output.bcf}
bcftools view {output.bcf} > {output.vcf}
"""
7 changes: 7 additions & 0 deletions env-bcftools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bcftools=1.11
- samtools
7 changes: 7 additions & 0 deletions env-minimap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- minimap2=2.17
- samtools=1.10
6 changes: 6 additions & 0 deletions env-wget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- wget
10 changes: 10 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: vc
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=3.6
- snakemake-minimal=5.30.1
- wget
- samtools=1.10

0 comments on commit 6697b53

Please sign in to comment.