Niche adaptation and microdiversity among populations of planktonic bacteria