code: def regress_genes(self, PCs):
          
  
          ind = [PCs]
          ind = np.array(ind).flatten()
          try:
              y = self.adata.X.toarray() - self.regression_pcs[:, ind].dot(
                  self.regression_pca.components_[ind, :] * self.adata.var[
                                                              'weights'].values)
          except BaseException:
              y = self.adata.X.toarray() - self.regression_pcs[:, ind].dot(
                  self.regression_pca.components_[ind, :])
  
          self.adata.X = sp.csr_matrix(y)
docs: Regress out the principal components in 'PCs' from the filtered
          expression data ('SAM.D'). Assumes 'calculate_regression_PCs' has
          been previously called.
  
          Parameters
          ----------
          PCs - int, numpy.array, list
              The principal components to regress out of the expression data.