Get rid of a nested group-by when reading sam file