{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Notebook to get important cite seq featues by predicting sex by cite\n\nY - sex, X - protein levels\n\nresults are stored in tables\n\n<..._weights.csv> - table with obtained coeffs after training\n\n<..._topN_abs.csv> - table top N genes by coeffs\n    \n<..._zeroN.csv> - table with zero genes by coeffs\n    \n#### Results:\n##### **The first ten largest weights affecting sex obtained for proteins**:\nMouse-IgG1, Mouse-IgG2a, Mouse-IgG2b, Rat-IgG2a, Rat-IgG2b, Rat-IgG1, CD13, KLRG1, CD81, CD49f\n##### **The 20 weights NOT affecting sex obtained for proteins**:\nCD31, CD134, CD79b, CD54, CD122, CD45RO, TIGIT, CD127, CD88, CD3, CD115, CD223, CD161, CD195, CD142, CD319, CD270, CD101, CD304, CD272<br> \n","metadata":{"execution":{"iopub.status.busy":"2023-01-16T15:28:26.648165Z","iopub.execute_input":"2023-01-16T15:28:26.648692Z","iopub.status.idle":"2023-01-16T15:28:26.658298Z","shell.execute_reply.started":"2023-01-16T15:28:26.648648Z","shell.execute_reply":"2023-01-16T15:28:26.656397Z"}}},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nfrom sklearn.linear_model import LassoCV, Lasso\nfrom sklearn.model_selection import cross_val_predict, KFold\nfrom sklearn.metrics import r2_score, mean_squared_error\nimport matplotlib.colors as mcolors\nimport matplotlib.pyplot as plt\nimport time\nfrom plotnine import *\nfrom scipy import stats\n","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:38:40.670772Z","iopub.execute_input":"2023-02-02T13:38:40.671264Z","iopub.status.idle":"2023-02-02T13:38:40.679015Z","shell.execute_reply.started":"2023-02-02T13:38:40.671228Z","shell.execute_reply":"2023-02-02T13:38:40.678036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# donor: > 30 000 - male, ~13 000 - female \nmeta_df = pd.read_csv('/kaggle/input/open-problems-multimodal/metadata.csv')\ncite = pd.read_hdf('/kaggle/input/open-problems-multimodal/train_cite_targets.h5') \ncite.describe()","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:39:23.867265Z","iopub.execute_input":"2023-02-02T13:39:23.867806Z","iopub.status.idle":"2023-02-02T13:39:25.591491Z","shell.execute_reply.started":"2023-02-02T13:39:23.867759Z","shell.execute_reply":"2023-02-02T13:39:25.590107Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite.head(3)","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:39:25.869437Z","iopub.execute_input":"2023-02-02T13:39:25.870650Z","iopub.status.idle":"2023-02-02T13:39:25.894990Z","shell.execute_reply.started":"2023-02-02T13:39:25.870588Z","shell.execute_reply":"2023-02-02T13:39:25.893843Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = cite.copy()\n# X = znorm(X)\nX = X.astype('float64')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:40:50.499768Z","iopub.execute_input":"2023-02-02T13:40:50.500327Z","iopub.status.idle":"2023-02-02T13:40:50.547373Z","shell.execute_reply.started":"2023-02-02T13:40:50.500287Z","shell.execute_reply":"2023-02-02T13:40:50.545749Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"meta_df['sex'] = np.where(meta_df['donor'] > 30000, 'Male', 'Female')\nY = meta_df[meta_df.cell_id.isin(X.index)].set_index(X.index)[['sex']]\nY = pd.get_dummies(Y)\nprint(Y)","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:40:52.472251Z","iopub.execute_input":"2023-02-02T13:40:52.472732Z","iopub.status.idle":"2023-02-02T13:40:52.668541Z","shell.execute_reply.started":"2023-02-02T13:40:52.472680Z","shell.execute_reply":"2023-02-02T13:40:52.667010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colors = mcolors.CSS4_COLORS\ncell_colors = dict(zip(cite.columns, [list(colors.keys())[i] for i in range(cite.columns.shape[0])]))\n\ndef highlight_cells(x):\n    return 'background-color: ' + x.map(\n        # Associate Values to a given colour code\n        cell_colors\n    ).fillna('gray')  # Fill unmapped values with default","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:40:54.941191Z","iopub.execute_input":"2023-02-02T13:40:54.941690Z","iopub.status.idle":"2023-02-02T13:40:54.949633Z","shell.execute_reply.started":"2023-02-02T13:40:54.941650Z","shell.execute_reply":"2023-02-02T13:40:54.948618Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Lasso CV5","metadata":{}},{"cell_type":"code","source":"weights_dict = {}\ny = Y['sex_Male'].values\nprint('sex', y[y == 0].shape[0], y[y == 1].shape[0])\n\nmodel = LassoCV(cv=5).fit(X, y)\nalpha_selected = model.alpha_\nprint('Optimal alpha found by CV: ', alpha_selected)\nweights_dict['sex'] = model.coef_\nprint(\"r^2 train score {}\".format(model.score(X, y)))\n\nmodel = Lasso(alpha = alpha_selected)\ny_pred = cross_val_predict(model, X, y, cv=5)\n\ns = r2_score(y,y_pred)\nprint('r2 Lasso', s)\ns = np.corrcoef(y,y_pred)[0,1]\nprint('Corr Lasso', s)\ns = mean_squared_error(y,y_pred, squared=False) # squared=False -> RMSE, not MSE \nprint('RMSE Lasso', s, '\\n')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:40:58.221716Z","iopub.execute_input":"2023-02-02T13:40:58.222108Z","iopub.status.idle":"2023-02-02T13:41:15.676659Z","shell.execute_reply.started":"2023-02-02T13:40:58.222076Z","shell.execute_reply":"2023-02-02T13:41:15.675025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nonzero_ind_ws = {}\nzero_ind_ws = {}\nzero_ind_ws['sex'] = np.where(weights_dict['sex'] == 0)[0]\nnonzero_ind_ws['sex'] = np.where(weights_dict['sex'] != 0)[0]\nprint(\"zero coef:\", len(zero_ind_ws['sex']), \"non-zero coef:\", len(nonzero_ind_ws['sex']))\n\nlasso_weights = pd.DataFrame(weights_dict, index = cite.columns)\nlasso_weights.to_csv('lasso_cv5_weigths.csv')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:41:15.685112Z","iopub.execute_input":"2023-02-02T13:41:15.686382Z","iopub.status.idle":"2023-02-02T13:41:15.718987Z","shell.execute_reply.started":"2023-02-02T13:41:15.686329Z","shell.execute_reply":"2023-02-02T13:41:15.717013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"top10 = {}\ntop10['sex'] = lasso_weights['sex'].abs().sort_values(ascending = False).index[:10].tolist()\nprint(\"top10:\\n\", ', '.join(top10['sex']))\nzero20 = {}\nzero20['sex'] = lasso_weights['sex'].abs().sort_values(ascending = True).index[:20].tolist()\nprint(\"zero20:\\n\", ', '.join(zero20['sex']))","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:41:15.727904Z","iopub.execute_input":"2023-02-02T13:41:15.734018Z","iopub.status.idle":"2023-02-02T13:41:15.768667Z","shell.execute_reply.started":"2023-02-02T13:41:15.733936Z","shell.execute_reply":"2023-02-02T13:41:15.766671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.DataFrame(zero20).to_csv('lasso_cv5_zero20.csv', index = False)\npd.DataFrame(top10).to_csv('lasso_cv5_top10_abs.csv', index = False)\npd.DataFrame(top10).style.apply(highlight_cells)","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:41:22.021171Z","iopub.execute_input":"2023-02-02T13:41:22.021695Z","iopub.status.idle":"2023-02-02T13:41:22.101543Z","shell.execute_reply.started":"2023-02-02T13:41:22.021656Z","shell.execute_reply":"2023-02-02T13:41:22.100422Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Graphics","metadata":{}},{"cell_type":"code","source":"df_join = pd.merge(meta_df, \n                   cite, \n                   on ='cell_id', \n                   how ='inner')\ndf_join.describe()","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:48:51.537855Z","iopub.execute_input":"2023-02-02T13:48:51.539234Z","iopub.status.idle":"2023-02-02T13:48:52.505466Z","shell.execute_reply.started":"2023-02-02T13:48:51.539182Z","shell.execute_reply":"2023-02-02T13:48:52.504579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_join.head(5)","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:48:56.930999Z","iopub.execute_input":"2023-02-02T13:48:56.931498Z","iopub.status.idle":"2023-02-02T13:48:56.963148Z","shell.execute_reply.started":"2023-02-02T13:48:56.931457Z","shell.execute_reply":"2023-02-02T13:48:56.961902Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_join['day'].unique()\n","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:49:00.178436Z","iopub.execute_input":"2023-02-02T13:49:00.178924Z","iopub.status.idle":"2023-02-02T13:49:00.189328Z","shell.execute_reply.started":"2023-02-02T13:49:00.178879Z","shell.execute_reply":"2023-02-02T13:49:00.188083Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_join['donor'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-02-02T13:49:01.691630Z","iopub.execute_input":"2023-02-02T13:49:01.692045Z","iopub.status.idle":"2023-02-02T13:49:01.698481Z","shell.execute_reply.started":"2023-02-02T13:49:01.692010Z","shell.execute_reply":"2023-02-02T13:49:01.697720Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Rat-IgG2b for various donors","metadata":{}},{"cell_type":"code","source":"donor_32606 = df_join[df_join['donor']==32606]['Rat-IgG2b']\ndonor_31800 = df_join[df_join['donor']==31800]['Rat-IgG2b']\ndonor_13176 = df_join[df_join['donor']==13176]['Rat-IgG2b']\n\n# remove outliers\ndonor_32606 = donor_32606[(np.abs(stats.zscore(donor_32606)) < 3)]\ndonor_31800 = donor_31800[(np.abs(stats.zscore(donor_31800)) < 3)]\ndonor_13176 = donor_13176[(np.abs(stats.zscore(donor_13176)) < 3)]","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:50:53.508401Z","iopub.execute_input":"2023-02-02T14:50:53.508990Z","iopub.status.idle":"2023-02-02T14:50:53.568038Z","shell.execute_reply.started":"2023-02-02T14:50:53.508948Z","shell.execute_reply":"2023-02-02T14:50:53.566900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axes = plt.subplots(nrows=2, ncols=2)\nax0, ax1, ax2, ax3 = axes.flatten()\nax0.hist(donor_32606, bins=100)\nax0.set_title('Rat-IgG2b: donor 32606')\nax1.hist(donor_31800, bins=100)\nax1.set_title('donor 31800')\nax2.hist(donor_13176, bins=100)\nax2.set_title('donor 13176')\nfig.tight_layout()\nplt.show()\nplt.savefig('Rat-IgG2b by donors.png')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:02.515444Z","iopub.execute_input":"2023-02-02T14:51:02.515892Z","iopub.status.idle":"2023-02-02T14:51:04.113995Z","shell.execute_reply.started":"2023-02-02T14:51:02.515829Z","shell.execute_reply":"2023-02-02T14:51:04.112684Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Rat-IgG2b for woman (donor 13176) by days","metadata":{}},{"cell_type":"code","source":"donor_13176_day2 = df_join[(df_join['donor']==13176) & (df_join['day']==2)]['Rat-IgG2b']\ndonor_13176_day3 = df_join[(df_join['donor']==13176) & (df_join['day']==3)]['Rat-IgG2b']\ndonor_13176_day4 = df_join[(df_join['donor']==13176) & (df_join['day']==4)]['Rat-IgG2b']\n# remove outliers\ndonor_13176_day2 = donor_13176_day2[(np.abs(stats.zscore(donor_13176_day2)) < 3)]\ndonor_13176_day3 = donor_13176_day3[(np.abs(stats.zscore(donor_13176_day3)) < 3)]\ndonor_13176_day4 = donor_13176_day4[(np.abs(stats.zscore(donor_13176_day4)) < 3)]","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:13.775469Z","iopub.execute_input":"2023-02-02T14:51:13.775911Z","iopub.status.idle":"2023-02-02T14:51:13.808977Z","shell.execute_reply.started":"2023-02-02T14:51:13.775876Z","shell.execute_reply":"2023-02-02T14:51:13.807618Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axes = plt.subplots(nrows=2, ncols=2)\nax0, ax1, ax2, ax3 = axes.flatten()\nax0.hist(donor_13176_day2, bins=100)\nax0.set_title('Rat-IgG2b: donor 13176, day2')\nax1.hist(donor_13176_day3, bins=100)\nax1.set_title('donor 13176, day3')\nax2.hist(donor_13176_day4, bins=100)\nax2.set_title('donor 13176, day4')\nfig.tight_layout()\nplt.show()\nplt.savefig('Rat-IgG2b for donor 13176.png')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:19.934884Z","iopub.execute_input":"2023-02-02T14:51:19.935310Z","iopub.status.idle":"2023-02-02T14:51:21.037138Z","shell.execute_reply.started":"2023-02-02T14:51:19.935273Z","shell.execute_reply":"2023-02-02T14:51:21.035551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Rat-IgG2b by cell_types","metadata":{}},{"cell_type":"code","source":"MasP = df_join[df_join['cell_type']=='MasP']['Rat-IgG2b']\nMkP = df_join[df_join['cell_type']=='MkP']['Rat-IgG2b']\nNeuP = df_join[df_join['cell_type']=='NeuP']['Rat-IgG2b']\nMoP = df_join[df_join['cell_type']=='MoP']['Rat-IgG2b'] \nEryP = df_join[df_join['cell_type']=='EryP']['Rat-IgG2b'] \nHSC = df_join[df_join['cell_type']=='HSC']['Rat-IgG2b']\nBP = df_join[df_join['cell_type']=='BP']['Rat-IgG2b']\n\n# remove outliers\nMasP = MasP[(np.abs(stats.zscore(MasP)) < 3)]\nMkP = MkP[(np.abs(stats.zscore(MkP)) < 3)]\nNeuP = NeuP[(np.abs(stats.zscore(NeuP)) < 3)]\nMoP = MoP[(np.abs(stats.zscore(MoP)) < 3)]\nEryP = EryP[(np.abs(stats.zscore(EryP)) < 3)]\nHSC = HSC[(np.abs(stats.zscore(HSC)) < 3)]\nBP = BP[(np.abs(stats.zscore(BP)) < 3)]","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:27.238756Z","iopub.execute_input":"2023-02-02T14:51:27.240487Z","iopub.status.idle":"2023-02-02T14:51:27.369176Z","shell.execute_reply.started":"2023-02-02T14:51:27.240411Z","shell.execute_reply":"2023-02-02T14:51:27.367579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axes = plt.subplots(nrows=2, ncols=2)\nax0, ax1, ax2, ax3 = axes.flatten()\nax0.hist(EryP, bins=100)\nax0.set_title('Rat-IgG2b for EryP')\nax1.hist(HSC, bins=100)\nax1.set_title('Rat-IgG2b for HSC')\nax2.hist(BP, bins=100)\nax2.set_title('Rat-IgG2b for BP')\nfig.tight_layout()\nplt.show()\nplt.savefig('Rat-IgG2b for EryP HSC BP.png')\n\nfig, axes = plt.subplots(nrows=2, ncols=2)\nax0, ax1, ax2, ax3 = axes.flatten()\nax0.hist(MasP, bins=100)\nax0.set_title('Rat-IgG2b for MasP')\nax1.hist(MkP, bins=100)\nax1.set_title('Rat-IgG2b for MkP')\nax2.hist(NeuP, bins=100)\nax2.set_title('Rat-IgG2b for NeuP')\nax3.hist(MoP, bins=100)\nax3.set_title('Rat-IgG2b for MoP')\nfig.tight_layout()\nplt.show()\nplt.savefig('Rat-IgG2b for MasP MkP NeuP MoP.png')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:35.104381Z","iopub.execute_input":"2023-02-02T14:51:35.104873Z","iopub.status.idle":"2023-02-02T14:51:37.315717Z","shell.execute_reply.started":"2023-02-02T14:51:35.104832Z","shell.execute_reply":"2023-02-02T14:51:37.314320Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Rat-IgG2b by (cell_type, donor)","metadata":{}},{"cell_type":"code","source":"cell_types = df_join['cell_type'].unique()\ndonors = df_join['donor'].unique()\ndays = [2, 3, 4]\nfor cell_type in cell_types:\n    for donor in donors:\n        cell_2 = df_join[(df_join['cell_type']==cell_type)& (df_join['donor']==donor) & (df_join['day']==days[0])]['Rat-IgG2b']\n        cell_3 = df_join[(df_join['cell_type']==cell_type)& (df_join['donor']==donor) & (df_join['day']==days[1])]['Rat-IgG2b']\n        cell_4 = df_join[(df_join['cell_type']==cell_type)& (df_join['donor']==donor) & (df_join['day']==days[2])]['Rat-IgG2b']\n        # remove outliers\n        cell_2 = cell_2[(np.abs(stats.zscore(cell_2)) < 3)]\n        cell_3 = cell_3[(np.abs(stats.zscore(cell_3)) < 3)]\n        cell_4 = cell_4[(np.abs(stats.zscore(cell_4)) < 3)]\n\n        fig, axes = plt.subplots(nrows=2, ncols=2)\n        ax0, ax1, ax2, ax3 = axes.flatten()\n        ax0.hist(cell_2, bins=100)\n        ax0.set_title('Rat-IgG2b: {}, {}, day{}'.format(cell_type, donor, days[0]))\n        ax1.hist(cell_3, bins=100)\n        ax1.set_title('{}, {}, day{}'.format(cell_type, donor, days[1]))\n        ax2.hist(cell_4, bins=100)\n        ax2.set_title('{}, {}, day{}'.format(cell_type, donor, days[2]))\n        fig.tight_layout()\n        #plt.hist(donor_32606, bins=100, legend='Rat-IgG2b for donor 32606')\n        plt.show()\n        plt.savefig('Rat-IgG2b for {}, donor {}.png'.format(cell_type, donor))","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:51:49.435150Z","iopub.execute_input":"2023-02-02T14:51:49.435591Z","iopub.status.idle":"2023-02-02T14:52:13.839497Z","shell.execute_reply.started":"2023-02-02T14:51:49.435556Z","shell.execute_reply":"2023-02-02T14:52:13.838067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Box plots","metadata":{}},{"cell_type":"code","source":"fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(9, 4))\n\n# generate some random test data\nall_data = [donor_32606, donor_31800, donor_13176]\n\n# plot violin plot\naxes[0].violinplot(all_data,\n                   showmeans=False,\n                   showmedians=True)\naxes[0].set_title('violin plot')\n\n# plot box plot\naxes[1].boxplot(all_data, showmeans=True)\naxes[1].set_title('box plot')\n\n# adding horizontal grid lines\nfor ax in axes:\n    ax.yaxis.grid(True)\n    ax.set_xticks([y+1 for y in range(len(all_data))])\n    ax.set_xlabel('Rat-IgG2b')\n    ax.set_ylabel('Expression level (normalized)')\n\n# add x-tick labels\nplt.setp(axes, xticks=[y+1 for y in range(len(all_data))],\n         xticklabels=['donor 32606', 'donor 31800', 'donor 13176'])\npos = np.arange(3) + 1\ntop=7\nmeans = [donor_32606.mean(), donor_31800.mean(), donor_13176.mean()]\nupperLabels = [str(np.round(s, 2)) for s in means]\nfor tick, label in zip(range(3), ax.get_xticklabels()):\n    ax.text(pos[tick], top - (top*0.05), upperLabels[tick],\n             horizontalalignment='center', size='x-small',\n             weight = 'semibold'\n             )\nplt.show()\nplt.savefig('Rat-IgG2b.png')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:25:43.697723Z","iopub.execute_input":"2023-02-02T14:25:43.698180Z","iopub.status.idle":"2023-02-02T14:25:44.474109Z","shell.execute_reply.started":"2023-02-02T14:25:43.698145Z","shell.execute_reply":"2023-02-02T14:25:44.472902Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"means = [str(round(MasP.mean(),2)), str(round(MkP.mean(),2)), str(round(NeuP.mean(),2)), str(round(MoP.mean(),2)), str(round(EryP.mean(),2)), str(round(HSC.mean(),2)), str(round(BP.mean(),2))]\nmeans","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:25:22.220005Z","iopub.execute_input":"2023-02-02T14:25:22.220447Z","iopub.status.idle":"2023-02-02T14:25:22.234449Z","shell.execute_reply.started":"2023-02-02T14:25:22.220410Z","shell.execute_reply":"2023-02-02T14:25:22.233188Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(9, 4))\n\nall_data = [MasP, MkP, NeuP, MoP, EryP, HSC, BP]\n\n# plot violin p\n\n# plot box plot\naxes.boxplot(all_data, showmeans=True)\naxes.set_title('Rat-IgG2b')\n\n# adding horizontal grid lines\nax.yaxis.grid(True)\nax.set_xticks([y+1 for y in range(len(all_data))])\nax.set_xlabel('Rat-IgG2b')\nax.set_ylabel('Expression level (normalized)')\n\n# add x-tick labels\nplt.setp(axes, xticks=[y+1 for y in range(len(all_data))],\n         \n         xticklabels=['MasP\\n{}'.format(means[0]), 'MkP\\n{}'.format(means[1]), 'NeuP\\n{}'.format(means[2]), 'MoP\\n{}'.format(means[3]),\n                      'EryP\\n{}'.format(means[4]), 'HSC\\n{}'.format(means[5]), 'BP\\n{}'.format(means[6])])\n\nplt.show()\nplt.savefig('Rat-IgG2b.png')","metadata":{"execution":{"iopub.status.busy":"2023-02-02T14:25:24.792644Z","iopub.execute_input":"2023-02-02T14:25:24.793059Z","iopub.status.idle":"2023-02-02T14:25:25.088116Z","shell.execute_reply.started":"2023-02-02T14:25:24.793026Z","shell.execute_reply":"2023-02-02T14:25:25.087241Z"},"trusted":true},"execution_count":null,"outputs":[]}]}