Skip to content

Commit

Permalink
update and add more sssom mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Sep 11, 2024
1 parent be7dfc3 commit 37effaa
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
8 changes: 8 additions & 0 deletions 00_fetch_data/sssom/fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rm -f *.sssom.tsv.gz

curl -L https://data.monarchinitiative.org/mappings/latest/upheno_custom.sssom.tsv | gzip > upheno_custom.sssom.tsv.gz
curl -L https://raw.githubusercontent.com/mapping-commons/mh_mapping_initiative/master/mappings/mp_hp_mgi_all.sssom.tsv | gzip > mp_hp_mgi_all.sssom.tsv.gz
curl -L https://raw.githubusercontent.com/obophenotype/bio-attribute-ontology/master/src/mappings/oba-efo.sssom.tsv | gzip > oba-efo.sssom.tsv.gz
curl -L https://raw.githubusercontent.com/obophenotype/bio-attribute-ontology/master/src/mappings/oba-vt.sssom.tsv | gzip > oba-vt.sssom.tsv.gz
13 changes: 7 additions & 6 deletions 01_ingest/grebi_ingest_sssom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ fn main() {
return line.trim_start_matches("#").to_string();
}).collect::<Vec<String>>().join("\n");

let yaml_header:serde_yaml::Value = serde_yaml::from_str::<serde_yaml::Value>(yaml.as_str()).unwrap();

let yaml_header_curie_map = yaml_header.get("curie_map").unwrap().as_mapping().unwrap();


let expand:PrefixMap = {
let mut builder = PrefixMapBuilder::new();
for (k, v) in yaml_header_curie_map {
builder.add_mapping(k.as_str().unwrap().to_string() + ":", v.as_str().unwrap().to_string());
let yaml_header:serde_yaml::Value = serde_yaml::from_str::<serde_yaml::Value>(yaml.as_str()).unwrap();
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());
}
}
builder.build()
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "MP_HP",
"name": "SSSOM",
"enabled": true,
"ingests": [
{
"ingest_files": [
"./00_fetch_data/sssom/mphp.sssom.tsv"
"./00_fetch_data/sssom/*.tsv.gz"
],
"ingest_script": "./target/release/grebi_ingest_sssom",
"ingest_args": []
Expand Down
3 changes: 1 addition & 2 deletions configs/subgraph_configs/ebi_full_monarch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"skos:exactMatch",
"ncit:P368",
"ncit:C98965",
"cheminf:000407",
"dcterms:identifier",
"oboinowl:hasAlternativeId",
"semapv:crossSpeciesExactMatch"
Expand Down Expand Up @@ -65,7 +64,7 @@
"./configs/datasource_configs/gwas.json",
"./configs/datasource_configs/hgnc.json",
"./configs/datasource_configs/impc.json",
"./configs/datasource_configs/mp_hp.json",
"./configs/datasource_configs/sssom.json",
"./configs/datasource_configs/ols.json",
"./configs/datasource_configs/reactome.json",
"./configs/datasource_configs/ubergraph.json",
Expand Down
1 change: 0 additions & 1 deletion configs/subgraph_configs/hett.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"skos:exactMatch",
"ncit:P368",
"ncit:C98965",
"cheminf:000407",
"dcterms:identifier",
"oboinowl:hasAlternativeId"
],
Expand Down
1 change: 0 additions & 1 deletion configs/subgraph_configs/hra_kg.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"skos:exactMatch",
"ncit:P368",
"ncit:C98965",
"cheminf:000407",
"dcterms:identifier",
"oboinowl:hasAlternativeId"
],
Expand Down
1 change: 0 additions & 1 deletion configs/subgraph_configs/monarch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"skos:exactMatch",
"ncit:P368",
"ncit:C98965",
"cheminf:000407",
"dcterms:identifier",
"oboinowl:hasAlternativeId"
],
Expand Down
2 changes: 1 addition & 1 deletion grebi_shared/src/prefix_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Node {
#[inline(always)]
fn reprefix_impl<'a>(subject:&[u8], buf:&[u8]) -> Option<Vec<u8>> {

if subject.len() == 0 {
if subject.len() == 0 || buf.len() == 0 {
return None;
}

Expand Down

0 comments on commit 37effaa

Please sign in to comment.