Skip to content

Commit

Permalink
add hack to make mesh chebi mappings work
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Oct 20, 2024
1 parent cf9f950 commit 4cedfde
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion 01_ingest/grebi_ingest_sssom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ fn main() {
let yaml_header_curie_map = yaml_header.get("curie_map");
if yaml_header_curie_map.is_some() {
for (k, v) in yaml_header_curie_map.unwrap().as_mapping().unwrap() {
builder.add_mapping(k.as_str().unwrap().to_string() + ":", v.as_str().unwrap().to_string());
let mut to_prefix = v.as_str().unwrap().to_string();

// hack for broken https://data.monarchinitiative.org/mappings/latest/mesh_chebi_biomappings.sssom.tsv
// the mesh IRI does not have a trailing /
// so we check if the last ch is alphanumeric, if so add a /
//
if to_prefix.chars().last().unwrap().is_alphanumeric() {
to_prefix = to_prefix + "/";
}

builder.add_mapping(k.as_str().unwrap().to_string() + ":", to_prefix);
}
}
builder.build()
Expand Down

0 comments on commit 4cedfde

Please sign in to comment.