Kinetics and mechanism of G-quadruplex formation and conformational switch in a G-quadruplex