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. 
If you included `sum` and `mean` here there wouldn't be a need to replicate the knowledge of `sum` and `mean` in several places in this file and in the script.