docs: def PC_varExplained(Y,standardized=True):
      """
      Run PCA and calculate the cumulative fraction of variance
      Args:
          Y: phenotype values
          standardize: if True, phenotypes are standardized
      Returns:
          var: cumulative distribution of variance explained
      """
      # figuring out the number of latent factors
      if standardized:
          Y-=Y.mean(0)
          Y/=Y.std(0)
      covY = sp.cov(Y)
      S,U = linalg.eigh(covY+1e-6*sp.eye(covY.shape[0]))
      S = S[::-1]
      rv = np.array([S[0:i].sum() for i in range(1,S.shape[0])])
      rv/= S.sum()
      return rv