Skip to content

Commit

Permalink
Create service method for get_tool_predictions operation from Workflo…
Browse files Browse the repository at this point in the history
…wAPI
  • Loading branch information
heisner-tillman committed Feb 20, 2024
1 parent 9a7ee48 commit 31cccca
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/galaxy/webapps/galaxy/services/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
InvocationsStateCounts,
WorkflowIndexQueryPayload,
)
from galaxy.schema.workflows import InvokeWorkflowPayload
from galaxy.schema.workflows import InvokeWorkflowPayload # GetToolPredictionsPayload,
from galaxy.tools import recommendations
from galaxy.util.tool_shed.tool_shed_registry import Registry
from galaxy.webapps.galaxy.services.base import ServiceBase
from galaxy.webapps.galaxy.services.sharable import ShareableService
Expand Down Expand Up @@ -53,6 +54,21 @@ def __init__(
self._serializer = serializer
self.shareable_service = ShareableService(workflows_manager, serializer, notification_manager)
self._tool_shed_registry = tool_shed_registry
self.tool_recommendations = recommendations.ToolRecommendations()

def get_tool_predictions(
self,
trans: ProvidesUserContext,
payload,
):
remote_model_url = payload.get("remote_model_url", trans.app.config.tool_recommendation_model_path)
tool_sequence = payload.get("tool_sequence", "")
if "tool_sequence" not in payload or remote_model_url is None:
return {}
tool_sequence, recommended_tools = self.tool_recommendations.get_predictions(
trans, tool_sequence, remote_model_url
)
return {"current_tool": tool_sequence, "predicted_data": recommended_tools}

def index(
self,
Expand Down

0 comments on commit 31cccca

Please sign in to comment.