Scientists have created what amounts to an automatic worm sorter on a chip.