code: def _set_iroot_via_xroot(self, xroot):
          
          if self._adata.shape[1] != xroot.size:
              raise ValueError(
                  'The root vector you provided does not have the '
                  'correct dimension.')
          # this is the squared distance
          dsqroot = 1e10
          iroot = 0
          for i in range(self._adata.shape[0]):
              diff = self._adata.X[i, :] - xroot
              dsq = diff.dot(diff)
              if dsq < dsqroot:
                  dsqroot = dsq
                  iroot = i
                  if np.sqrt(dsqroot) < 1e-10: break
          logg.msg('setting root index to', iroot, v=4)
          if self.iroot is not None and iroot != self.iroot:
              logg.warn('Changing index of iroot from {} to {}.'.format(self.iroot, iroot))
          self.iroot = iroot
docs: Determine the index of the root cell.
  
          Given an expression vector, find the observation index that is closest
          to this vector.
  
          Parameters
          ----------
          xroot : np.ndarray
              Vector that marks the root cell, the vector storing the initial
              condition, only relevant for computing pseudotime.