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

sorted all menus #545

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

sorted all menus #545

wants to merge 3 commits into from

Conversation

kwcantrell
Copy link
Collaborator

This sorts all drop down menus and the node select menu. This should hopefully make it much easier to find things 😄

@emperor-helper
Copy link

The following artifacts were built for this PR: empire-biplot.qzv, empire.qzv, empress-tree.qzv, just-fm.qzv, plain.qzv

@fedarko fedarko self-requested a review August 12, 2021 19:16
Copy link
Collaborator

@fedarko fedarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kwcantrell! Some of the abstractions done here from select-node-menu.js are really nice -- moving this sort of logic out of the node menu and into empress is a good idea.

That being said, I am not sure that the actual end goal of this PR, sorting all metadata columns, is always going to be beneficial. For sample metadata columns I can definitely see the benefit, but for feature metadata (esp. when the only feature metadata in use is QIIME 2 taxonomy feature metadata, which I think is a pretty common use case right now) not using the default ordering will make it so that Confidence is always the first listed value (as seen on the moving pictures dataset) --

image

... in my opinion this will almost always be inconvenient for users, since showing the taxonomy columns before the other feature metadata is usually what we want. Especially w/r/t taxonomy metadata, the confidence information describes the confidence of the taxonomic annotations, so I think it makes sense to list it after taxonomy rather than beforehand.

That being said, I understand that Emperor already sorts its feature metadata columns when listing them in the biplot coloring menu, so ... if we want to make this change anyway I can deal with it :)

es

Comment on lines -299 to 292
if (_.has(mdObj, nodeName)) {
if (this.empress.hasFeatureMetadata(nodeName)) {
var headerRow = this.fmTable.insertRow(-1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like the modified code considers tipOrInt any more. Is this due to nodeName no longer being the node name but actually just being the postorder position of a node in the tree (in which case there is no longer any ambiguity, since each position should be unique relative to all other nodes)? If so, we should update this function / its documentation, and probably other stuff in this module that still assumes nodes are referred to by their names. (That change is not really in scope of this PR, though -- I'm fine with delegating that to another issue, since I imagine doing it right will be a huge pain.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, tipOrInt no longer being used. empress.hasFetaureMetadata and empress.getNodeFeatureMetadataValue replace its functionality. I don't believe ambiguity is an issue since tip names must be unique thus if nodeName is in tipMetadata then by definition it cannot be in intMetadata and vice-versa. Right?

Assuming I am not looking over anything, I'll remove tipOrInt from the doc string.

tests/test-barplots.js Outdated Show resolved Hide resolved
empress/support_files/js/empress.js Outdated Show resolved Hide resolved
empress/support_files/js/empress.js Outdated Show resolved Hide resolved
empress/support_files/js/empress.js Outdated Show resolved Hide resolved
empress/support_files/js/empress.js Outdated Show resolved Hide resolved
empress/support_files/js/empress.js Outdated Show resolved Hide resolved
if (_.has(this._intMetadata, node)) {
return this._intMetadata[node][colIndx];
}
return undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, should this ever happen in practice? At least in the context of makeFeatureMetadataTable() I don't think it should, since we've already called Empress.hasFeatureMetadata(). I vote we throw an error here instead, unless I am missing something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can throw an error. I choose to return undefined in case the calling function wants to do something special in situations where no metadata exists (which I guess can also be handled by a try catch block).

@kwcantrell
Copy link
Collaborator Author

The main motivation behind sorting everything came up while demonstrating EMPress to the health team during Tuesdays meeting. They have a lot of metadata columns and the current method made it fairly difficult to find things. I think for more general uses, this will be the case. It maybe nice to list confidence after taxonomy but I think that small convenience is outweighed by the possible frustration of having to search for every other category. I could be wrong though 😄

@fedarko
Copy link
Collaborator

fedarko commented Aug 12, 2021

Fair enough! Since there's a compelling reason for it, I don't mind this change.

I think that small convenience is outweighed by the possible frustration of having to search for every other category.

Agreed.

We miiiight be able to get the best of both worlds by renaming Confidence to Taxonomy Confidence or something, which would automatically mean that the column would be listed after the taxonomy levels (the Level 1 names, etc. are already made up by Empress, so this has precedent). But that fix will cause its own problems and is a discussion for another day :)

kwcantrell and others added 2 commits August 26, 2021 12:04
Co-authored-by: Marcus Fedarko <marcus.fedarko@gmail.com>
@kwcantrell
Copy link
Collaborator Author

Looks like McHelper is failing again... 😢

@kwcantrell
Copy link
Collaborator Author

@fedarko I believe I addressed all your comments.

@ElDeveloper
Copy link
Member

ElDeveloper commented Aug 26, 2021 via email

@ElDeveloper
Copy link
Member

Yep, artifacts should be updated now.

@ElDeveloper
Copy link
Member

@fedarko any chance you can review and merge if things look good to you?

@fedarko fedarko self-requested a review October 26, 2021 19:46
@fedarko
Copy link
Collaborator

fedarko commented Oct 26, 2021

@ElDeveloper yep, I will do my best to get to the remaining open pull requests ASAP.

@ElDeveloper
Copy link
Member

ElDeveloper commented Oct 27, 2021 via email

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.

4 participants