diff --git a/cellphonedb/src/core/methods/method_launcher.py b/cellphonedb/src/core/methods/method_launcher.py index 413b23b5..99a82419 100644 --- a/cellphonedb/src/core/methods/method_launcher.py +++ b/cellphonedb/src/core/methods/method_launcher.py @@ -122,6 +122,7 @@ def _counts_validations(counts: pd.DataFrame, meta: pd.DataFrame) -> pd.DataFram counts = counts.astype(pd.np.float) # type: pd.DataFrame except: raise ParseCountsException + meta.index = meta.index.astype(str) for cell in meta.index.values: if cell not in counts.columns.values: raise ParseCountsException('Some cells in meta didnt exist in counts columns', diff --git a/cellphonedb/src/core/preprocessors/method_preprocessors.py b/cellphonedb/src/core/preprocessors/method_preprocessors.py index 0448ab5e..c95b7d7d 100644 --- a/cellphonedb/src/core/preprocessors/method_preprocessors.py +++ b/cellphonedb/src/core/preprocessors/method_preprocessors.py @@ -28,6 +28,7 @@ def meta_preprocessor(meta_raw: pd.DataFrame) -> pd.DataFrame: meta = pd.DataFrame(data={'cell_type': meta_raw.iloc[:, 1]}) meta.set_index(meta_raw.iloc[:, 0], inplace=True) meta.index.name = 'cell' + meta.index = meta.index.astype(str) return meta except: diff --git a/run_cellphonedb_rabbitmq.py b/run_cellphonedb_rabbitmq.py index 951664c4..41455f3c 100755 --- a/run_cellphonedb_rabbitmq.py +++ b/run_cellphonedb_rabbitmq.py @@ -170,30 +170,44 @@ def heatmaps_plot_results(meta: str, pvalues: str, pvalue: float, job_id: str): count_name = 'plot_count__{}.png'.format(job_id) count_log_name = 'plot_count_log__{}.png'.format(job_id) + count_network_name = 'count_network__{}.txt'.format(job_id) + interactions_count_name = 'interactions_count__{}.txt'.format(job_id) + heatmaps_plot(meta_file=meta_file.name, pvalues_file=pvalues_file.name, output_path=output_path, count_name=count_name, log_name=count_log_name, + count_network_filename=count_network_name, + interaction_count_filename=interactions_count_name, pvalue=pvalue) output_count_file = os.path.join(output_path, count_name) output_count_log_file = os.path.join(output_path, count_log_name) + output_count_network_file = os.path.join(output_path, count_network_name) + output_interactions_count_file = os.path.join(output_path, interactions_count_name) - if not os.path.exists(output_count_file) or not os.path.exists(output_count_log_file): - raise PlotException('Could not generate output file for plot of type dot_plot') + if not os.path.exists(output_count_file) \ + or not os.path.exists(output_count_log_file) \ + or not os.path.exists(output_count_network_file) \ + or not os.path.exists(output_interactions_count_file): + raise PlotException('Could not generate output file for plot of type heatmap_plot') response = { 'job_id': job_id, 'files': { 'count_plot': count_name, - 'count_log_plot': count_log_name + 'count_log_plot': count_log_name, + 'count_network': count_network_name, + 'interactions_sum': interactions_count_name, }, 'success': True } write_image_to_s3(output_count_file, count_name) write_image_to_s3(output_count_log_file, count_log_name) + write_image_to_s3(output_count_network_file, count_network_name) + write_image_to_s3(output_interactions_count_file, interactions_count_name) return response