Skip to content

Commit

Permalink
Add default snpEff SARS-CoV-2 database
Browse files Browse the repository at this point in the history
Avoids errors if the Azure-based default snpEff repository doesn't work
  • Loading branch information
ahmig committed Oct 24, 2023
1 parent 6166e09 commit 7f66832
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Binary file added config/snpeff/NC_045512.2/snpEffectPredictor.bin
Binary file not shown.
21 changes: 15 additions & 6 deletions workflow/rules/vaf.smk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rule snps_to_ancestor:
shell:
"""
set -e
exec >{log}
exec >{log}
exec 2>&1
ref=`samtools view -H {input.bam} | grep ^@SQ | cut -d"\t" -f2 | sed 's/SN://g'`
Expand Down Expand Up @@ -135,22 +135,31 @@ rule tsv_to_vcf:

rule variants_effect:
threads: 1
shadow: "minimal"
conda: "../envs/snpeff.yaml"
params:
ref_name = config["ALIGNMENT_REFERENCE"]
ref_name = config["ALIGNMENT_REFERENCE"],
snpeff_data_dir = (BASE_PATH / "config" / "snpeff").resolve()
input:
vcf = OUTDIR/f"{OUTPUT_NAME}.vcf"
output:
ann_vcf = temp(OUTDIR/f"{OUTPUT_NAME}.annotated.vcf")
log:
LOGDIR / "variants_effect" / "log.txt"
retries: 2
shell:
"""
exec >{log}
exec >{log}
exec 2>&1
snpEff eff {params.ref_name} {input.vcf} > {output.ann_vcf} || true
rm snpEff_genes.txt snpEff_summary.html
# Check if snpEff database is available
if [ -d "{params.snpeff_data_dir}/{params.ref_name}" ]; then
echo "Using local database at '{params.snpeff_data_dir}'"
else
echo "Local database not found at '{params.snpeff_data_dir}', downloading from repository"
fi
snpEff eff -dataDir {params.snpeff_data_dir} -noStats {params.ref_name} {input.vcf} > {output.ann_vcf}
"""


Expand Down

0 comments on commit 7f66832

Please sign in to comment.