Skip to content

Commit

Permalink
[DATALAD RUNCMD] Rename SPECIES_URI_TEMPLATE into NCBITAXON_URI_TEMPLATE
Browse files Browse the repository at this point in the history
since otherwise while looking at the use not clear
what that index is.  May be later it would be even
some other level (but still the same template) than species
so best to just mention that it is NCBITAXON URL

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "git-sedi SPECIES_URI_TEMPLATE NCBITAXON_URI_TEMPLATE",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic committed Mar 1, 2024
1 parent a62fe7d commit a670474
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions dandi/metadata/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,68 +329,68 @@ def extract_cellLine(metadata: dict) -> str | None:
return None


SPECIES_URI_TEMPLATE = "http://purl.obolibrary.org/obo/NCBITaxon_{}"
NCBITAXON_URI_TEMPLATE = "http://purl.obolibrary.org/obo/NCBITaxon_{}"

# common_names, prefix, uri, name
species_map = [
(
["mouse"],
"mus",
SPECIES_URI_TEMPLATE.format("10090"),
NCBITAXON_URI_TEMPLATE.format("10090"),
"Mus musculus - House mouse",
),
(
["human"],
"homo",
SPECIES_URI_TEMPLATE.format("9606"),
NCBITAXON_URI_TEMPLATE.format("9606"),
"Homo sapiens - Human",
),
(
["rat", "norvegicus"],
None,
SPECIES_URI_TEMPLATE.format("10116"),
NCBITAXON_URI_TEMPLATE.format("10116"),
"Rattus norvegicus - Norway rat",
),
(
["rattus rattus"],
None,
SPECIES_URI_TEMPLATE.format("10117"),
NCBITAXON_URI_TEMPLATE.format("10117"),
"Rattus rattus - Black rat",
),
(
["mulatta", "rhesus"],
None,
SPECIES_URI_TEMPLATE.format("9544"),
NCBITAXON_URI_TEMPLATE.format("9544"),
"Macaca mulatta - Rhesus monkey",
),
(
["jacchus"],
None,
SPECIES_URI_TEMPLATE.format("9483"),
NCBITAXON_URI_TEMPLATE.format("9483"),
"Callithrix jacchus - Common marmoset",
),
(
["melanogaster", "fruit fly"],
None,
SPECIES_URI_TEMPLATE.format("7227"),
NCBITAXON_URI_TEMPLATE.format("7227"),
"Drosophila melanogaster - Fruit fly",
),
(
["danio", "zebrafish", "zebra fish"],
None,
SPECIES_URI_TEMPLATE.format("7955"),
NCBITAXON_URI_TEMPLATE.format("7955"),
"Danio rerio - Zebra fish",
),
(
["c. elegans", "caenorhabditis elegans"],
"caenorhabditis",
SPECIES_URI_TEMPLATE.format("6239"),
NCBITAXON_URI_TEMPLATE.format("6239"),
"Caenorhabditis elegans",
),
(
["pig-tailed macaque", "pigtail monkey", "pigtail macaque"],
None,
SPECIES_URI_TEMPLATE.format("9545"),
NCBITAXON_URI_TEMPLATE.format("9545"),
"Macaca nemestrina",
),
]
Expand Down Expand Up @@ -441,7 +441,7 @@ def extract_species(metadata: dict) -> models.SpeciesType | None:
value_orig,
flags=re.I,
):
normed_value = SPECIES_URI_TEMPLATE.format(m[1])
normed_value = NCBITAXON_URI_TEMPLATE.format(m[1])
for _common_names, _prefix, uri, name in species_map:
if uri == normed_value:
value_id = uri
Expand Down

0 comments on commit a670474

Please sign in to comment.