From 1efa3d14bc1cd80f3457146d1f4168f8fcf33a69 Mon Sep 17 00:00:00 2001 From: Chunyu Ma Date: Tue, 19 Nov 2024 11:57:09 -0500 Subject: [PATCH] add attributes regarding biolink:knowledge_level and biolink:agent_type for xDTD/xCRG edges --- .../Infer/scripts/infer_utilities.py | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py b/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py index 88d0cb189..dcf3bc5fe 100644 --- a/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py +++ b/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py @@ -223,8 +223,9 @@ def genrete_treat_subgraphs(self, response: ARAXResponse, top_scores: pd.DataFra attribute_source="infores:arax", value_type_id="metatype:Boolean", value_url=None, description="This edge is a container for a computed value between two nodes that is not directly attachable to other edges."), - Attribute(attribute_type_id="EDAM-DATA:0951", original_attribute_name="probability_treats", - value=str(treat_score)) + Attribute(attribute_type_id="EDAM-DATA:0951", original_attribute_name="probability_treats", value=str(treat_score)), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] retrieval_source = [ RetrievalSource(resource_id="infores:arax", resource_role="primary_knowledge_source") @@ -339,7 +340,9 @@ def genrete_treat_subgraphs(self, response: ARAXResponse, top_scores: pd.DataFra new_edge = Edge(subject=subject_curie, object=object_curie, predicate=predicate, attributes=[], sources=[]) ## add attributes to the path-based edge edge_attribute_list = [ - Attribute(original_attribute_name="defined_datetime", value=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), attribute_type_id="metatype:Datetime") + Attribute(original_attribute_name="defined_datetime", value=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), attribute_type_id="metatype:Datetime"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] if predicate == "biolink:self_loop_relation": edge_attribute_list += [ @@ -373,7 +376,9 @@ def genrete_treat_subgraphs(self, response: ARAXResponse, top_scores: pd.DataFra edge_attribute_list = [ Attribute(original_attribute_name="defined_datetime", value=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), attribute_type_id="metatype:Datetime"), Attribute(original_attribute_name=None, value=True, attribute_type_id="EDAM-DATA:1772", attribute_source="infores:arax", value_type_id="metatype:Boolean", value_url=None, description="This edge is a container for a computed value between two nodes that is not directly attachable to other edges."), - Attribute(attribute_type_id="EDAM-DATA:0951", original_attribute_name="probability_treats", value=str(treat_score)) + Attribute(attribute_type_id="EDAM-DATA:0951", original_attribute_name="probability_treats", value=str(treat_score)), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] retrieval_source = [ RetrievalSource(resource_id="infores:arax", resource_role="primary_knowledge_source") @@ -605,8 +610,9 @@ def genrete_regulate_subgraphs(self, response: ARAXResponse, query_chemical: Opt attribute_source="infores:arax", value_type_id="metatype:Boolean", value_url=None, description="This edge is a container for a computed value between two nodes that is not directly attachable to other edges."), - Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", - value=str(prob_score)) + Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", value=str(prob_score)), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] retrieval_source = [ RetrievalSource(resource_id="infores:arax", resource_role="primary_knowledge_source") @@ -655,7 +661,9 @@ def genrete_regulate_subgraphs(self, response: ARAXResponse, query_chemical: Opt attribute_source="infores:arax", value_type_id="metatype:Boolean", value_url=None, description="This edge is a container for a computed value between two nodes that is not directly attachable to other edges."), - Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", value=str(prob_score)) + Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", value=str(prob_score)), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] if model_type == 'increase': edge_qualifier_direction = 'increased' @@ -769,7 +777,9 @@ def genrete_regulate_subgraphs(self, response: ARAXResponse, query_chemical: Opt edge_attribute_list = [ Attribute(original_attribute_name="defined_datetime", value=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), attribute_type_id="metatype:Datetime"), Attribute(original_attribute_name=None, value=True, attribute_type_id="EDAM-DATA:1772", attribute_source="infores:arax", value_type_id="metatype:Boolean", value_url=None, description="This edge is a container for a computed value between two nodes that is not directly attachable to other edges."), - Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", value=str(regulate_score)) + Attribute(attribute_type_id="EDAM-OPERATION:2434", original_attribute_name=f"probably_{model_type}_activity", value=str(regulate_score)), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:agent_type", value="computational_model"), + Attribute(attribute_source="infores:arax", attribute_type_id="biolink:knowledge_level", value="prediction") ] retrieval_source = [ RetrievalSource(resource_id="infores:arax", resource_role="primary_knowledge_source")