add script for collapsing replicate samples

~~**NOT READY FOR MERGE**~~

 - [x] port and test collapse functions

 ~~possibly generalize to replace ``summarize_otu_by_cat.py`` and take an ``axis`` parameter~~
 - [x] needs biom > 2.1, so dependent on a release

This may ultimately make more sense to be part of BIOM, so may end up closing this PR without merge, but submitting now in case others have feedback. 

Note: this includes commits in #1685. 
a context manager here would be nice