Skip to content

Commit

Permalink
WIP nxontology_ml_train_predict
Browse files Browse the repository at this point in the history
  • Loading branch information
dhimmel committed Oct 10, 2023
1 parent d067b42 commit 291fff3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nxontology_data/efo/efo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pandas as pd
import rdflib
from nxontology import NXOntology
from nxontology_ml.model.predict import train_predict as nxontology_ml_train_predict

from nxontology_data.utils import (
get_source_output_dir,
Expand Down Expand Up @@ -319,6 +320,18 @@ def write_outputs(self) -> None:
)
if nxo.name == "efo_otar_profile":
nxo_slim = self.create_slim_nxo(nxo)
# classify EFO node/disease precision using nxontology-ml
nxo_slim.freeze()
logger.info("Beginning nxontology-ml disease precision classification.")
precision_df = nxontology_ml_train_predict(nxo=nxo_slim)
write_dataframe(
precision_df,
output_dir.joinpath(f"{self.name}_precision_classifications.json.gz"),
)
for row in precision_df.itertuples():
nxo_slim.graph.nodes[row.identifier][
"disease_precision"
] = row.precision
write_ontology(nxo_slim, output_dir, compression_threshold_mb=30.0)

@staticmethod
Expand Down

0 comments on commit 291fff3

Please sign in to comment.