Skip to content

Commit

Permalink
Redesigned support for URL to host genome
Browse files Browse the repository at this point in the history
  • Loading branch information
DrYak committed Mar 12, 2022
1 parent 0dd9c72 commit d77fa11
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
19 changes: 17 additions & 2 deletions workflow/rules/dehuman.smk
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from functools import partial


localrules:
download_host_ref,


rule dh_reuse_alignreject:
# "rely on aligner's output".
# this rule re-use the rejected reads in align.smk (e.g. ngshmmalign's /alignments/rejects.sam)
Expand Down Expand Up @@ -83,10 +87,21 @@ rule dh_redo_alignreject:
"""


rule download_host_ref:
output:
host_ref=config.dehuman["ref_host"],
params:
host_ref_url=config.dehuman["ref_host_url"],
shell:
"""
curl --output "{output.host_ref}" "{params.host_ref_url}"
"""


rule dh_hostalign:
input:
host_ref=cachepath(config.dehuman["ref_host"]),
ref_index=multiext(cachepath(config.dehuman["ref_host"]), *bwa_idx_ext),
host_ref=config.dehuman["ref_host"],
ref_index=multiext(config.dehuman["ref_host"], *bwa_idx_ext),
reject_1=rules.dh_redo_alignreject.output.reject_1
if config["dehuman"]["catchup"]
else rules.dh_reuse_alignreject.output.reject_1,
Expand Down
10 changes: 8 additions & 2 deletions workflow/schemas/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,16 @@
"default": 4
},
"ref_host": {
"type": "string",
"default": "references/human.fa.gz",
"description": "Host's genome used to remove reads (e.g. human genome)\n\n**Note:** if this file is absent, it is possible to fetch it from a remote server, see property `ref_host_url` below.",
"examples": ["/cluster/project/igenomes/Homo_sapiens/NCBI/GRCh38/Sequence/BWAIndex/genome.fa"]
},
"ref_host_url": {
"type": "string",
"default": "http://ftp.ensembl.org/pub/release-105/fasta/homo_sapiens/dna/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz",
"description": "Host's genome used to remove reads (e.g. human genome)\n\n**Note:** although directly fetching the reference from the network can work, we _strongly advise_ to use local files (e.g., download the reference locally or use one provided by your cluster).",
"examples": ["references/human.fa", "/cluster/project/igenomes/Homo_sapiens/NCBI/GRCh38/Sequence/BWAIndex/genome.fa", "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/001/405/GCA_000001405.29_GRCh38.p14/GCA_000001405.29_GRCh38.p14_genomic.fna.gz"]
"description": "If the host's genome specified in property `ref_host` isn't present, fetch it from a remote server.\n\n**Note** remember to set aside enough memory for the indexing rule, see section `ref_bwa_index` property `mem`.",
"examples": [ "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/001/405/GCA_000001405.29_GRCh38.p14/GCA_000001405.29_GRCh38.p14_genomic.fna.gz"]
},
"keep_host": {
"type": "boolean",
Expand Down

0 comments on commit d77fa11

Please sign in to comment.