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

ENH:Allow for missing features in feature metadata #734

Merged
merged 3 commits into from
Oct 22, 2019

Conversation

ElDeveloper
Copy link
Member

@ElDeveloper ElDeveloper commented Sep 11, 2019

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

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
@@ -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')
Copy link
Contributor

Choose a reason for hiding this comment

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

this is awesome!

Copy link
Contributor

@mortonjt mortonjt left a 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))
Copy link
Contributor

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

https://realpython.com/python-f-strings/

@ElDeveloper
Copy link
Member Author

This PR is ready for review if anyone would like to have a look.

Copy link
Member

@wasade wasade left a 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 Show resolved Hide resolved
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]))
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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 :/

Copy link
Member Author

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 👍

emperor/core.py Outdated Show resolved Hide resolved
The output is truncated to 5 missing elements.
@wasade
Copy link
Member

wasade commented Oct 22, 2019

👍

@wasade wasade merged commit 8a530bc into biocore:new-api Oct 22, 2019
@ElDeveloper
Copy link
Member Author

ElDeveloper commented Oct 22, 2019 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.

ignore-missing-samples doesn't apply to arrows
3 participants