-
Notifications
You must be signed in to change notification settings - Fork 37
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
add formatting #295
add formatting #295
Conversation
@Oddant1 I still have to add number formatting to parts of the output, which I am working on now, but this is the basis and just adds the rounding. I am trying to see where I can do the rounding -- either in the jinja html or in the summary function. I am not sure which is better or more clear. |
I would advocate for doing the rounding in the Python function rather than the jinja html. My gut is that the former would be easier to test than the latter, and potentially more clear to future developers. |
@Oddant1 @gregcaporaso this should be ready to pull in. |
@Clockwork-Rat, should this be a Draft Pull Request until we sort out the plan for handling |
@gregcaporaso @Oddant1 this should be working as expected. |
summary = pd.Series([frequencies.min(), frequencies.quantile(0.25), | ||
frequencies.median(), frequencies.quantile(0.75), | ||
frequencies.max(), frequencies.mean()], | ||
table = table.to_dataframe() |
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.
Here's a better approach we can use:
nonzeros = table.matrix_data.data
This will take the BIOM table to a Sparse Matrix, and then the raw non-zero data, which will prevent setting up a dataframe and iterating over rows or columns, since we don't care about where the values are, just their intergery-ness.
@Clockwork-Rat, |
Thanks @Clockwork-Rat! I think (@ebolyen, please correct me if I'm wrong) that we'll never have ints as input here, so it would be safe to drop your check and just always round. @hagenjp, do you mind pulling this down and testing the changes like you did with the last iteration? Note that in this iteration, both @Clockwork-Rat, can you also add a note to the release notes document that the interface of |
@Clockwork-Rat @gregcaporaso These changes look good to me! |
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.
@Clockwork-Rat, could you a take a pass through and remove everything we don't need from this PR, now that we're not concerned about supporting relative frequency values? Sorry for the trouble - this is one of those PRs that had a big change in direction once we got into it.
@hagenjp @gregcaporaso here are the changes with the removed logic. |
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.
Looks good, thanks @Clockwork-Rat!
Closes #293
Adds formatting and rounds summary output.