Niche and dispersal effects on biodiversity, community composition and species co-occurrences in stream ecosystems