Tyson Gay has pulled out of next month's World Championships after admitting he has tested positive for a banned substance.