Semantic similarity between patient's HPOs and rare diseases' HPOs
- TODO: SimCLR 설치하기
- HPO definition에 대한 embedding vector 구하기
$ python3 concept_embedding.py -k [OpenAI key] -e hpo_definition -i 0.18 --resume
- HPO name 대한 embedding vector 구하기
$ python3 concept_embedding.py -k [OpenAI key] -e hpo_name -i 0.18 --resume
>>> from core.data_model import Ontology
>>> from core.io_ops import load_pickle
>>> from ontology_src import ARTIFACT_PATH
>>> hpos = load_pickle(ARTIFACT_PATH["hpo_name"])
>>> my_ontology = Ontology(hpos)
>>> patient_hpos = my_ontology(["HP:0000005", "HP:0000006"])
>>> patient_hpos.vector
array([[-0.00792581, 0.01476753, -0.00463055, ..., -0.00431325,
0.01031215, -0.02622988],
[-0.00972291, 0.02108144, -0.00561761, ..., -0.00913226,
0.00773679, -0.01496731]])
>>> for hpo in hpos:
>>> print(hpo)
HPO(id='HP:0000005', name='Mode of inheritance', ...)
HPO(id='HP:0000006', name='Autosomal dominant inheritance', ...,)
>>> "HP:0000005" in patient_hpos
True
>>> HPO(id="HP:0000005",...) in patient_hpos
True
>>> patient_hpos["HP:0000005"]
HPO(id='HP:0000005', name='Mode of inheritance', ...)
$ git clone https://github.com/4pygmalion/SemanticSimilarity.git
$ cd SemanticSimilarity
$ pip install .