-
Notifications
You must be signed in to change notification settings - Fork 50
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
ENH:Allow for missing features in feature metadata #734
Conversation
Allows for feature metadata to not include some of the features represented in the ordination. The errors and warnings have been updated to properly refer to either features or samples. I've added a couple of tests to validate the error/warning messages. Fixes biocore#730 Fixes biocore#733
8bdc115
to
490afbd
Compare
@@ -250,7 +251,7 @@ def __init__(self, ordination, mapping_file, feature_mapping_file=None, | |||
self.feature_mf = \ | |||
self._validate_metadata(feature_mapping_file, | |||
self.ordination.features, | |||
ignore_missing_samples=False) | |||
ignore_missing_samples, kind='feature') |
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.
this is awesome!
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.
I've tested this on my datasets, it looks like this resolved the problem. Thanks!
emperor/core.py
Outdated
"file. Override this error by using the " | ||
"`ignore_missing_samples` argument. Offending " | ||
"samples: %s" | ||
% ', '.join(sorted([str(i) for i in difference]))) | ||
"%ss: %s" % (kind, kind, kind, elements)) |
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.
Not necessary for this PR, but py3.6 has f-strings that look pretty cool
This PR is ready for review if anyone would like to have a look. |
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.
Just a few small comments, looks great though!!
emperor/core.py
Outdated
|
||
if difference and not ignore_missing_samples: | ||
raise KeyError("There are samples not included in the mapping " | ||
elements = ', '.join(sorted([str(i) for i in difference])) |
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.
Can this be a truncated list? If thousands of features are missing, the output will be substantial especially if they're sOTUs
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.
I think it's ok since QIIME2 would hide the list of features by default and only if the user uses --verbose
the full text will be displayed. What do you think?
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.
Does it...? I ran q2-emperor from 2019.7 recently with malformed metadata and got a buffer full of output on the terminal :/
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.
Got it, just addressed this 👍
The output is truncated to 5 missing elements.
👍 |
Thanks so much @wasade!
…On (Oct-22-19|11:10), Daniel McDonald wrote:
Merged #734 into new-api.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#734 (comment)
|
Allows for feature metadata to not include some of the features
represented in the ordination. The errors and warnings have been updated
to properly refer to either features or samples. I've added a couple of
tests to validate the error/warning messages.
Fixes #730 and #733