ENH: by sample_ids is now single pass and not in memory