abstracted subsample_by_taxonomy and moved to functions