def cpdb_statistical_analysis_launcher(
        self,
        raw_meta: pd.DataFrame,
        counts: pd.DataFrame,
        counts_data: str,
        iterations: int,
        threshold: float,
        threads: int,
        debug_seed: int,
        result_precision: int,
        pvalue: float,
        subsampler: Subsampler = None,
    ) -> (pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame):

        if threads < 1:
            core_logger.info('Using Default thread number: %s' %
                             self.default_threads)
            threads = self.default_threads

        if threshold < 0 or threshold > 1:
            raise ThresholdValueException(threshold)

        meta = method_preprocessors.meta_preprocessor(raw_meta)
        counts = self._counts_validations(counts, meta)

        if subsampler is not None:
            counts = subsampler.subsample(counts)
            meta = meta.filter(items=(list(counts)), axis=0)

        interactions = self.database_manager.get_repository(
            'interaction').get_all_expanded(include_gene=False)
        genes = self.database_manager.get_repository('gene').get_all_expanded()
        complex_composition = self.database_manager.get_repository(
            'complex').get_all_compositions()
        complex_expanded = self.database_manager.get_repository(
            'complex').get_all_expanded()

        deconvoluted, means, pvalues, significant_means = \
            cpdb_statistical_analysis_method.call(meta,
                                                  counts,
                                                  counts_data,
                                                  interactions,
                                                  genes,
                                                  complex_expanded,
                                                  complex_composition,
                                                  iterations,
                                                  threshold,
                                                  threads,
                                                  debug_seed,
                                                  result_precision,
                                                  pvalue,
                                                  self.separator)

        return pvalues, means, significant_means, deconvoluted
Beispiel #2
0
    def cpdb_statistical_analysis_launcher(self,
                                           raw_meta: pd.DataFrame,
                                           counts: pd.DataFrame,
                                           iterations: int,
                                           threshold: float,
                                           threads: int,
                                           debug_seed: int,
                                           result_precision: int
                                           ) -> (pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame):

        if threads < 1:
            core_logger.info('Using Default thread number: %s' % self.default_threads)
            threads = self.default_threads

        if threshold < 0 or threshold > 1:
            raise ThresholdValueException(threshold)

        meta = method_preprocessors.meta_preprocessor(raw_meta)
        counts = self._counts_validations(counts, meta)

        interactions = self.database_manager.get_repository('interaction').get_all_expanded(
            only_cellphonedb_interactor=True)
        genes = self.database_manager.get_repository('gene').get_all_expanded()
        complex_composition = self.database_manager.get_repository('complex').get_all_compositions()
        complex_expanded = self.database_manager.get_repository('complex').get_all_expanded()

        deconvoluted, mean_pvalue, means, pvalues, significant_means = \
            cpdb_statistical_analysis_method.call(meta,
                                                  counts,
                                                  interactions,
                                                  genes,
                                                  complex_expanded,
                                                  complex_composition,
                                                  iterations,
                                                  threshold,
                                                  threads,
                                                  debug_seed,
                                                  result_precision)

        return pvalues, means, significant_means, mean_pvalue, deconvoluted
    def cpdb_statistical_analysis_launcher(
        self, raw_meta: pd.DataFrame, counts: pd.DataFrame, threads: int,
        debug_seed: int, result_precision: int, log2_transform: bool
    ) -> (pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame
          ):

        if threads < 1:
            core_logger.info('Using Default thread number: %s' %
                             self.default_threads)
            threads = self.default_threads

        meta = method_preprocessors.meta_preprocessor(raw_meta)
        counts = self._counts_validations(counts, meta)

        winsorized = \
            cpdb_statistical_analysis_method.call(meta,
                                                  counts,
                                                  threads,
                                                  debug_seed,
                                                  result_precision,
                                                  log2_transform)

        return winsorized