Theory on the mechanism of site-specific DNA–protein interactions in the presence of traps