Cohomologies and anomalies in supersymmetric theories