-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
560 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def headmap(scores, name=''):\n", | ||
" import matplotlib.pyplot as plt\n", | ||
" import numpy as np\n", | ||
" import seaborn\n", | ||
" fig, ax = plt.subplots(1, 1, figsize=(4, 4), sharey=True)\n", | ||
" vmin = np.nanmin(scores)\n", | ||
" vmax = np.nanmax(scores)\n", | ||
"\n", | ||
" seaborn.heatmap(scores, ax=ax, square=False, cbar=False, annot=True, fmt='.2f', vmin=vmin, vmax=vmax)\n", | ||
" # Remove only the ticks, keep labels\n", | ||
" ax.tick_params(left=False, bottom=False)\n", | ||
" ax.xaxis.set_tick_params(width=0)\n", | ||
" ax.yaxis.set_tick_params(width=0)\n", | ||
" ax.set_title(name, pad=10)\n", | ||
"\n", | ||
"\n", | ||
" plt.tight_layout()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
" ex(True)_tf(-1) ex(False)_tf(-1) ex(True)_tf(140) \n", | ||
"seurat_lognorm 0.278739 0.193066 0.278739 \\\n", | ||
"lognorm 0.279906 0.194220 0.279906 \n", | ||
"pearson 0.373893 0.301601 0.373893 \n", | ||
"scgen_pearson 0.453783 0.377673 0.453783 \n", | ||
"seurat_pearson 0.366976 0.290578 0.366976 \n", | ||
"scgen_lognorm 0.376297 0.279118 0.376297 \n", | ||
"\n", | ||
" ex(False)_tf(140) Mean \n", | ||
"seurat_lognorm 0.193066 0.235902 \n", | ||
"lognorm 0.194220 0.237063 \n", | ||
"pearson 0.301601 0.337747 \n", | ||
"scgen_pearson 0.377673 0.415728 \n", | ||
"seurat_pearson 0.290578 0.328777 \n", | ||
"scgen_lognorm 0.279118 0.327708 \n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import yaml\n", | ||
"\n", | ||
"# Load the YAML file\n", | ||
"result_file = '../resources/results/0/scores.yaml'\n", | ||
"with open(result_file, 'r') as file:\n", | ||
" data = yaml.safe_load(file)\n", | ||
"\n", | ||
"# Initialize a dictionary to hold DataFrames for each method_id\n", | ||
"dfs = {}\n", | ||
"\n", | ||
"# Process each entry in the YAML file\n", | ||
"for entry in data:\n", | ||
" method_id = entry['method_id']\n", | ||
" dataset_id = entry['dataset_id']\n", | ||
" \n", | ||
" # If the method_id is not yet in the dictionary, initialize an empty DataFrame\n", | ||
" if method_id not in dfs:\n", | ||
" dfs[method_id] = pd.DataFrame()\n", | ||
" \n", | ||
" # Create a dictionary with metric_ids as keys and metric_values as values\n", | ||
" metrics_dict = dict(zip(entry['metric_ids'], entry['metric_values']))\n", | ||
" \n", | ||
" # Convert the dictionary to a DataFrame with dataset_id as the index\n", | ||
" df_entry = pd.DataFrame(metrics_dict, index=[dataset_id])\n", | ||
" \n", | ||
" # Append the entry to the corresponding DataFrame\n", | ||
" dfs[method_id] = pd.concat([dfs[method_id], df_entry])\n", | ||
"\n", | ||
"# Example: Access the DataFrame for 'reg1-scenicplus'\n", | ||
"df_scenicplus = dfs.get('reg1-scenicplus')\n", | ||
"print(df_scenicplus)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# import pandas as pd\n", | ||
"# output_dir = '../out'\n", | ||
"# grn_models = ['celloracle','scenicplus','figr']\n", | ||
"\n", | ||
"# col = 'ex(False)_tf(-1)'\n", | ||
"# scores = pd.DataFrame()\n", | ||
"# for grn in grn_models:\n", | ||
"# df = pd.read_csv(f\"{output_dir}/{grn}.csv\", index_col=0)\n", | ||
"# scores[grn] = df[col]\n", | ||
"# headmap(scores, name=col)\n", | ||
"\n", | ||
"# col = 'ex(True)_tf(-1)'\n", | ||
"# scores = pd.DataFrame()\n", | ||
"# for grn in grn_models:\n", | ||
"# df = pd.read_csv(f\"{output_dir}/{grn}.csv\", index_col=0)\n", | ||
"# scores[grn] = df[col]\n", | ||
"# headmap(scores, name=col)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "py10", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# param_list: | ||
# - id: test_process_perturbation | ||
# perturbation_counts: "s3://openproblems-data/resources/grn/datasets_raw/perturbation_counts.h5ad" | ||
param_list: | ||
- id: test_process_perturbation | ||
perturbation_counts: "s3://openproblems-data/resources/grn/datasets_raw/perturbation_counts.h5ad" | ||
|
||
# output_state: "state.yaml" | ||
# publish_dir: "s3://openproblems-data/resources/grn/results/process_perturbation/run_5" | ||
output_state: "state.yaml" | ||
publish_dir: "s3://openproblems-data/resources/grn/results/process_perturbation/run_5" | ||
|
||
|
||
|
Oops, something went wrong.