#!/usr/bin/env python # coding: utf-8 # # Overview of CyTOF Data # The original data was given as two tab-separated matrices # * ``Plasma.txt`` (original name: 160202_CGI002_Plasma_Plasma_singlets.fcs_raw_events.txt) # * ``PMA.txt`` (original name: 160202_CGI002_PMA_PMA_singlets.fcs_raw_events.txt) # # These files had individual cell measurements as rows and dimensions (e.g. antibodies) as columns. I only kept the dimensions of interest surface marker and phospho marker antibody columns/dimensions and renamed these files ``Plasma_clean.txt`` and ``PMA_clean.txt``. # # In[1]: import pandas as pd import numpy as np from clustergrammer_widget import * net = Network() # In[2]: net.load_file('../cytof_data/Plasma_CT.txt') df_plasma = net.export_df() # In[3]: net.load_df(df_plasma) df_plasma.shape # In[4]: net.normalize(axis='col', norm_type='zscore', keep_orig=False) # In[5]: net.downsample(ds_type='kmeans', axis='row', num_samples=1000) net.dat['mat'].shape # In[6]: # clip z-scores since we do not are about extreme outliers net.clip(-10,10) # In[7]: net.make_clust(views=[]) clustergrammer_widget(network=net.widget()) # # PMA # In[12]: net.load_file('../cytof_data/PMA_CT.txt') df_pma = net.export_df() # In[13]: net.load_df(df_pma) df_pma.shape # In[14]: net.normalize(axis='col', norm_type='zscore', keep_orig=False) net.downsample(ds_type='kmeans', axis='row', num_samples=1000) net.dat['mat'].shape net.clip(-10,10) # In[15]: net.make_clust(views=[]) clustergrammer_widget(network=net.widget()) # # Merge Plasma and PMA # In[12]: df_plasma.shape # In[13]: df_pma.shape # In[14]: df_merge = pd.concat([df_plasma, df_pma]) # In[15]: df_merge.shape # In[16]: net.load_df(df_merge) # In[17]: net.normalize(axis='col', norm_type='zscore', keep_orig=False) net.downsample(ds_type='kmeans', axis='row', num_samples=1000) net.clip(-10,10) net.dat['mat'].shape # In[18]: net.make_clust(views=[]) clustergrammer_widget(network=net.widget()) # ## Merged Results # # The above heatmap mixes both surface markers and phosphorylation markers. We can see that PMA treated cells have higher levels of phospohrylation of # * pCREB # * PMAPKAP2 # * pERK12 # * pp38 # # and higher levels of the CD14 surface marker. # # We want to also see how our cells cluster based on phosphorylation markers only and surface markers only. # In[ ]: