Sample preparation for sorting