Esempio n. 1
0
 def diffexp_topN(self,
                  obsFilterA,
                  obsFilterB,
                  top_n=None,
                  interactive_limit=None):
     if Axis.VAR in obsFilterA or Axis.VAR in obsFilterB:
         raise FilterError(
             "Observation filters may not contain vaiable conditions")
     try:
         obs_mask_A = self._axis_filter_to_mask(obsFilterA["obs"],
                                                self.data.obs,
                                                self.data.n_obs)
         obs_mask_B = self._axis_filter_to_mask(obsFilterB["obs"],
                                                self.data.obs,
                                                self.data.n_obs)
     except (KeyError, IndexError) as e:
         raise FilterError(f"Error parsing filter: {e}") from e
     if top_n is None:
         top_n = DEFAULT_TOP_N
     result = diffexp_ttest(self.data, obs_mask_A, obs_mask_B, top_n,
                            self.config['diffexp_lfc_cutoff'])
     try:
         return jsonify_scanpy(result)
     except ValueError:
         raise JSONEncodingValueError(
             "Error encoding differential expression to JSON")
Esempio n. 2
0
 def diffexp_topN(self,
                  obsFilterA,
                  obsFilterB,
                  top_n=None,
                  interactive_limit=None):
     if Axis.VAR in obsFilterA or Axis.VAR in obsFilterB:
         raise FilterError(
             "Observation filters may not contain vaiable conditions")
     try:
         obs_mask_A = self._axis_filter_to_mask(obsFilterA["obs"],
                                                self.data.obs,
                                                self.data.n_obs)
         obs_mask_B = self._axis_filter_to_mask(obsFilterB["obs"],
                                                self.data.obs,
                                                self.data.n_obs)
     except (KeyError, IndexError) as e:
         raise FilterError(f"Error parsing filter: {e}") from e
     if top_n is None:
         top_n = DEFAULT_TOP_N
     result = diffexp_ttest(self.data, obs_mask_A, obs_mask_B, top_n,
                            self.diffexp_lfc_cutoff)
     return result