Skip to content

Commit

Permalink
DeepProfiler data stat analysis (heatmap and umap)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenna-tomkinson committed Jan 19, 2023
1 parent e71bb1f commit 0f2e400
Show file tree
Hide file tree
Showing 24 changed files with 4,952 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ example_code.ipynb

# ignore deprecated notebooks
5_analyze_data/notebooks/UMAP_analysis/deprecated_notebooks

Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,228 changes: 1,160 additions & 68 deletions 5_analyze_data/notebooks/Heatmap_analysis/nf1_heatmap.ipynb

Large diffs are not rendered by default.

49 changes: 11 additions & 38 deletions 5_analyze_data/notebooks/Heatmap_analysis/nf1_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@

# ## Import libraries

# In[8]:
# In[1]:


import matplotlib.pyplot as plt
import pathlib
import pandas as pd
import seaborn as sb

import sys
sys.path.append("../UMAP_analysis/")
import UMAPutils as utils


# ## Read in NF1 data `csv`

# In[9]:
# In[2]:


norm_fs_data = pathlib.Path("../../../4_processing_features/data/nf1_sc_norm_fs_cellprofiler.csv.gz")
Expand All @@ -27,49 +31,18 @@
data.head()


# ## Helper function to split `csv` into metadata and features

# In[10]:


def split_data(pycytominer_output: pd.DataFrame):
"""
split pycytominer output to return metadata dataframe
Parameters
----------
pycytominer_output : pd.DataFrame
dataframe with pycytominer output
Returns
-------
pd.Dataframe, np.array
metadata dataframe, feature_data
"""
# split metadata from features
metadata_cols = [
col_name
for col_name in pycytominer_output.columns.tolist()
if "Metadata" in col_name
]
metadata_dataframe = pycytominer_output[metadata_cols]
feature_data = pycytominer_output[pycytominer_output.columns.difference(metadata_cols)]

return metadata_dataframe, feature_data


# ## Split NF1 data `csv`

# In[11]:
# In[3]:


metadata_dataframe, feature_data = split_data(data)
metadata_dataframe, feature_data = utils.split_data(data)
feature_data


# ## Transpose the NF1 dataframe

# In[12]:
# In[4]:


data_trans = feature_data.transpose()
Expand All @@ -78,7 +51,7 @@ def split_data(pycytominer_output: pd.DataFrame):

# ## Create correlation heatmap

# In[13]:
# In[5]:


data_trans_heatmap = sb.heatmap(data_trans.corr())
Expand All @@ -91,7 +64,7 @@ def split_data(pycytominer_output: pd.DataFrame):

# ## Create clustermap with correlation heatmap

# In[14]:
# In[6]:


sb.clustermap(data_trans.corr(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Get 2D UMAP embeddings for NF1 data"
"# Get 2D UMAP embeddings for NF1 CellProfiler data"
]
},
{
Expand Down Expand Up @@ -510,7 +510,7 @@
}
],
"source": [
"save_path = pathlib.Path('../../data/norm_fs_embeddings.csv.gz')\n",
"save_path = pathlib.Path('../../data/norm_fs_embeddings_cp.csv.gz')\n",
"\n",
"norm_fs_embeddings_data = utils.merge_metadata_embeddings(metadata_dataframe, embeddings, save_path)\n",
"norm_fs_embeddings_data"
Expand All @@ -533,7 +533,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:18) \n[GCC 10.3.0]"
"version": "3.8.13"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
Loading

0 comments on commit 0f2e400

Please sign in to comment.