biocore/scikit-bio — pull request #206 by ElBrogrammer (2014-03-20 18:45:14+00:00)
Title: Port subsample_multinomial from pycogent

Ported `subsample_multinomial` from PyCogent:

- improved its unit tests, as the previous ones also worked for subsampling without replacement
- combined multinomial subsampling with the `subsample` function as the functions shared a fair amount of code, and both are pretty short
- kept `subsample_multinomial`, which is now a simple wrapper. Useful in QIIME's case, where it expects the subsampling functions to share a common interface
- fixed a potential pitfall that modified the input `counts` vector in place, and also returned it. This behavior was inconsistent with `subsample`, which doesn't modify in place

I'd appreciate it if at least one other person looked over `test_subsample_multinomial` to verify that the tests are sane and that I'm not misunderstanding what multinomial subsampling is. The previous unit test in PyCogent wasn't that great because it also worked for subsampling *without* replacement. These new tests work only when subsampling *with* replacement.