-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show tool with the latest version #9828
base: release_20.05
Are you sure you want to change the base?
Conversation
Show tool with the latest version as recommendations
lib/galaxy/tools/recommendations.py
Outdated
all_tools = dict() | ||
for t in a_tools: | ||
t_versions = list() | ||
for t_v in a_tools[t]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to get the index without sorting.
Something along the lines of:
max_index, max_value = max(enumerate(values), key=operator.itemgetter(1))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, will test it and update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify this a bit
@@ -100,13 +101,29 @@ def __set_model(self, trans, remote_model_url): | |||
for k in tool_pos_sorted: | |||
self.tool_weights_sorted[k] = tool_weights[str(k)] | |||
# collect ids and names of all the installed tools | |||
all_t = dict() | |||
for tool_id, tool in trans.app.toolbox.tools(): | |||
t_id_renamed = tool_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use if tool.is_latest_version
and then drop the other changes
Show tool with the latest version as recommendations. There are some tools with Ids such as Filter1, Cut1 with no-tool version information embedded in these. But there are tools such as Bowtie2, Trimmomatic which contain their versions embedded in their ids. While showing recommendations, it is useful to fetch the latest version of these tools (and users can change the versions if they like).