|
| 1 | +## Rules to create build annonars functional annotation database.. |
| 2 | + |
| 3 | + |
| 4 | +rule work_annonars_functional_download_37: # -- download functional data for GRCh37 |
| 5 | + output: |
| 6 | + "work/download/refseq/grch37/{version}/{assembly}_genomic.gff.gz", |
| 7 | + shell: |
| 8 | + r""" |
| 9 | + wget -O {output} \ |
| 10 | + https://ftp.ncbi.nlm.nih.gov/genomes/all/annotation_releases/9606/{wildcards.version}/{wildcards.assembly}/{wildcards.assembly}_genomic.gff.gz |
| 11 | + """ |
| 12 | + |
| 13 | + |
| 14 | +rule work_annonars_functional_download_38: # -- download functional data for GRCh37 |
| 15 | + output: |
| 16 | + "work/download/refseq/grch38/{version}/{assembly}_genomic.gff.gz", |
| 17 | + shell: |
| 18 | + r""" |
| 19 | + wget -O {output} \ |
| 20 | + https://ftp.ncbi.nlm.nih.gov/genomes/all/annotation_releases/9606/{wildcards.version}/{wildcards.assembly}/{wildcards.assembly}_genomic.gff.gz |
| 21 | + """ |
| 22 | + |
| 23 | + |
| 24 | +def output_annonars_functional_input(wildcards): |
| 25 | + if wildcards.genome_release == "grch37": |
| 26 | + return f"work/download/refseq/grch37/{DV.refseq_fe_37}/GCF_000001405.25_GRCh37.p13_genomic.gff.gz" |
| 27 | + else: |
| 28 | + return f"work/download/refseq/grch38/{DV.refseq_fe_38}/GCF_000001405.40_GRCh38.p14_genomic.gff.gz" |
| 29 | + |
| 30 | + |
| 31 | +rule output_annonars_functional: # -- build annonars functional RocksDB file |
| 32 | + input: |
| 33 | + output_annonars_functional_input, |
| 34 | + output: |
| 35 | + rocksdb_identity=( |
| 36 | + "output/full/annonars/functional-{genome_release}-{v_refseq}+{v_annonars}/" |
| 37 | + "rocksdb/IDENTITY" |
| 38 | + ), |
| 39 | + spec_yaml=( |
| 40 | + "output/full/annonars/functional-{genome_release}-{v_refseq}+{v_annonars}/spec.yaml" |
| 41 | + ), |
| 42 | + wildcard_constraints: |
| 43 | + v_refseq=RE_VERSION, |
| 44 | + v_annonars=RE_VERSION, |
| 45 | + shell: |
| 46 | + r""" |
| 47 | + export TMPDIR=$(mktemp -d) |
| 48 | + trap "rm -rf $TMPDIR" EXIT |
| 49 | +
|
| 50 | + zgrep '^#\|RefSeqFE' {input} > $TMPDIR/tmp.gff |
| 51 | +
|
| 52 | + annonars functional import -vvv \ |
| 53 | + --genome-release {wildcards.genome_release} \ |
| 54 | + --path-in-gff $TMPDIR/tmp.gff \ |
| 55 | + --path-out-rocksdb $(dirname {output.rocksdb_identity}) |
| 56 | +
|
| 57 | + varfish-db-downloader tpl \ |
| 58 | + --template rules/output/annonars/functional.spec.yaml \ |
| 59 | + --value today={TODAY} \ |
| 60 | + \ |
| 61 | + --value version={wildcards.v_refseq}+{wildcards.v_annonars} \ |
| 62 | + --value v_refseq={wildcards.v_refseq} \ |
| 63 | + \ |
| 64 | + --value v_annonars={wildcards.v_annonars} \ |
| 65 | + --value v_downloader={PV.downloader} \ |
| 66 | + > {output.spec_yaml} |
| 67 | + """ |
0 commit comments