Endogenous and exogenous factors driving bacterial community composition in aquatic ecosystems