From Structure to Function: the Ecology of Host-Associated Microbial Communities