Skip to content
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

Draft
wants to merge 3 commits into
base: release_20.05
Choose a base branch
from

Conversation

anuprulez
Copy link
Member

@anuprulez anuprulez commented May 28, 2020

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).

Show tool with the latest version as recommendations
all_tools = dict()
for t in a_tools:
t_versions = list()
for t_v in a_tools[t]:
Copy link
Contributor

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))

Copy link
Member Author

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

Copy link
Member

@mvdbeek mvdbeek left a 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
Copy link
Member

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

@nsoranzo nsoranzo marked this pull request as draft September 16, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants