Competition and coevolution drive the evolution and the diversification of CRISPR immunity