Skip to content

Commit

Permalink
Add additional comments related to the different patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnathan Schaff committed Feb 7, 2024
1 parent 45be250 commit 355b755
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/config_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@
# kwargs for status check
STATUS_CHECK = {"id": "1017", "index": "mygene_current"}

# This essentially bypasses the es.get fallback as in myvariant ...
# The first regex matched integers, in which case the query becomes against
# entrezgeneall annotation queries are now multimatch against the following fields

# CURIE ID support based on BioLink Model
BIOLINK_MODEL_PREFIX_BIOTHINGS_GENE_MAPPING = {
"NCBIGene": {"type": "gene", "field": ["entrezgene", "retired"]},
Expand All @@ -182,13 +178,22 @@
pattern = (expression, field_match)
biolink_curie_regex_list.append(pattern)

# This essentially bypasses the es.get fallback as in myvariant ...
# The first regex matched integers, in which case the query becomes against
# entrezgeneall annotation queries are now multimatch against the following
# fields
fallback_pattern = (re.compile(r"^\d+$"), ["entrezgene", "retired"])

# The default pattern is neither the fallback pattern of the biolink
# CURIE ID prefixes match the pattern. This pattern matches the default
# presented in the ESQueryBuilder in the biothings.api library.
# Infers based off empty scopes
default_pattern = (re.compile(r"(?P<scope>\w+):(?P<term>[^:]+)"), [])

ANNOTATION_ID_REGEX_LIST = [
*biolink_curie_regex_list,
(re.compile(r"^\d+$"), ["entrezgene", "retired"]),
(
re.compile(r"(?P<scope>\w+):(?P<term>[^:]+)"),
[],
), # default regex pattern matching
fallback_pattern,
default_pattern,
]

ANNOTATION_DEFAULT_SCOPES = ["_id", "entrezgene", "ensembl.gene", "retired"]
Expand Down

0 comments on commit 355b755

Please sign in to comment.