[1]:
import pandas as pd
import seaborn as sns
import matplotlib.pylab as plt

Step 1, read data

[2]:
df = pd.read_csv("cell_count.csv")
[3]:
df.head()
[3]:
Sample: no dex Sample: 0.1uM dex Sample: 1uM dex Sample:no dex+FG Sample:0.1uM dex+FG Sample:0.5uM dex+FG Sample:1uM dex+FG
0 62148 7502 2 42928.0 0 830 26
1 16184 54398 8 28.0 0 6 2
2 31780 64 42 162.0 2 4 2
3 13060 22 3940 0.0 0 6 104
4 63812 16 8 0.0 0 138 4
[4]:
df = df.fillna(0)

generate density plot for each column

[15]:

for c in df.columns.tolist(): # print (c.replace(":","_").replace(" ","_")) plt.figure() sns.distplot(df[c],hist=False) plt.xscale("log") out = c.replace(":","_").replace(" ","_") plt.savefig(f"{out}.pdf",bbox_inches='tight')
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
../_images/jupyter_notebooks_python_seaborn_distplot_6_1.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_2.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_3.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_4.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_5.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_6.png
../_images/jupyter_notebooks_python_seaborn_distplot_6_7.png

merge each density

[17]:
for c in df.columns.tolist():
    sns.distplot(df[c],hist=False,label=c)
plt.xscale("log")
plt.legend()
plt.savefig(f"merged_density.pdf",bbox_inches='tight')
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
../_images/jupyter_notebooks_python_seaborn_distplot_8_1.png
[29]:
# log transformation
import numpy as np
for c in df.columns.tolist():
    # print (c.replace(":","_").replace(" ","_"))
    plt.figure()
    sns.distplot(df[c].apply(lambda x:np.log2(x+1)),hist=False,label=c)
    # plt.xscale("log")
    out = c.replace(":","_").replace(" ","_")
    plt.xlim(0,25)
    plt.legend()
    plt.xlabel("log2 cell count")
    plt.savefig(f"{out}_log.pdf",bbox_inches='tight')

/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
../_images/jupyter_notebooks_python_seaborn_distplot_9_1.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_2.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_3.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_4.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_5.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_6.png
../_images/jupyter_notebooks_python_seaborn_distplot_9_7.png
[24]:
# log transformation
import numpy as np
for c in df.columns.tolist():
    sns.distplot(df[c].apply(lambda x:np.log2(x+1)),hist=False,label=c)
plt.xlim(0,25)
plt.legend()
plt.xlabel("log2 cell count")
plt.savefig(f"merged_log.pdf",bbox_inches='tight')

/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
/home/yli11/.conda/envs/captureC/lib/python3.8/site-packages/seaborn/distributions.py:2619: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).
  warnings.warn(msg, FutureWarning)
../_images/jupyter_notebooks_python_seaborn_distplot_10_1.png