Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #118 from Teichlab/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mvento authored Sep 9, 2019
2 parents 91b9c44 + 33a59eb commit 3d62800
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions cellphonedb/src/core/methods/method_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions cellphonedb/src/core/preprocessors/method_preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 17 additions & 3 deletions run_cellphonedb_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3d62800

Please sign in to comment.