4-Substituted derivatives of pyrazolo[3,4-d]pyrimidine and pyrrolo[2,3-d]pyrimidine and uses thereof