biocore / biom-format

The Biological Observation Matrix (BIOM) Format Project
http://biom-format.org
Other
89 stars 95 forks source link

Expand partiton API #937

Closed wasade closed 3 months ago

wasade commented 1 year ago

...to allow for calling remove_empty and for removing samples which do not fall into a bin. See https://github.com/qiime2/q2-feature-table/pull/277#discussion_r1277792071

cc @gregcaporaso

gregcaporaso commented 1 year ago

A couple of other API additions that would be convenient are if:

  1. instead of providing the function a user could alternatively pass the mapping in directly, for example either as a dict mapping ids to groups, or a dict mapping groups to lists of ids
  2. empty vectors on the axis opposite to the one this operation is being performed on (i.e., features with zero count in a particular partition of samples) could optionally be dropped.

If the three of these were implemented, that would move all of the interesting logic in my https://github.com/qiime2/q2-feature-table/pull/277 to the biom.Table API.

I think it should be possible to do all of this without biom.Table.partition breaking changes - all just additions with defaults set to match current behavior.

wasade commented 1 year ago

These are excellent suggestions, and agree it can be done w/o breaking the API. Thanks!