Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ingest: Remove use of ncov-ingest geolocation rules #303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ingest/defaults/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ curate:
authors_default_value: '?'
# Field name for the generated abbreviated authors
abbr_authors_field: 'authors'
# General geolocation rules to apply to geolocation fields
geolocation_rules_url: 'https://raw.githubusercontent.com/nextstrain/ncov-ingest/master/source-data/gisaid_geoLocationRules.tsv'
# Local geolocation rules that are only applicable to mpox data
# Local rules can overwrite the general geolocation rules provided above
local_geolocation_rules: 'defaults/geolocation-rules.tsv'
# User annotations file
annotations: 'defaults/annotations.tsv'
Expand Down
27 changes: 2 additions & 25 deletions ingest/rules/curate.smk
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@ Parameters are expected to be defined in `config.curate`.
"""


rule fetch_general_geolocation_rules:
output:
general_geolocation_rules="data/general-geolocation-rules.tsv",
params:
geolocation_rules_url=config["curate"]["geolocation_rules_url"],
shell:
"""
curl {params.geolocation_rules_url} > {output.general_geolocation_rules}
"""


rule concat_geolocation_rules:
input:
general_geolocation_rules="data/general-geolocation-rules.tsv",
local_geolocation_rules=config["curate"]["local_geolocation_rules"],
output:
all_geolocation_rules="data/all-geolocation-rules.tsv",
shell:
"""
cat {input.general_geolocation_rules} {input.local_geolocation_rules} >> {output.all_geolocation_rules}
"""


def format_field_map(field_map: dict[str, str]) -> str:
"""
Format dict to `"key1"="value1" "key2"="value2"...` for use in shell commands.
Expand All @@ -46,7 +23,7 @@ def format_field_map(field_map: dict[str, str]) -> str:
rule curate:
input:
sequences_ndjson="data/sequences.ndjson",
all_geolocation_rules="data/all-geolocation-rules.tsv",
geolocation_rules=config["curate"]["local_geolocation_rules"],
annotations=config["curate"]["annotations"],
output:
metadata="data/all_metadata.tsv",
Expand Down Expand Up @@ -92,7 +69,7 @@ rule curate:
--default-value {params.authors_default_value} \
--abbr-authors-field {params.abbr_authors_field} \
| augur curate apply-geolocation-rules \
--geolocation-rules {input.all_geolocation_rules} \
--geolocation-rules {input.geolocation_rules} \
| augur curate apply-record-annotations \
--annotations {input.annotations} \
--id-field {params.annotations_id} \
Expand Down
2 changes: 1 addition & 1 deletion phylogenetic/defaults/color_ordering.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -16857,6 +16857,7 @@ country Bahamas
country North America
country Bermuda
country USA
country Puerto Rico
country Canada

################
Expand Down Expand Up @@ -16943,4 +16944,3 @@ lineage A.2.3
lineage A.3

################