{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nfrom PIL import Image\nimport torchvision.transforms as transforms\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nimport random\n\n# Any results you write to the current directory are saved as output.\ndf = pd.read_csv('../input/train.csv')\nexps = df['experiment'].unique()\nexps = [exp.split('-')[0] for exp in exps]\nexp_series = pd.Series(exps)\ncell_lines = exp_series.unique()\nprint('four cell lines are: ', cell_lines)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Type Wide Comparision(Same Channel)\nComparision Over same channel and different type of images"},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"df = pd.read_csv('../input/train.csv')\ndf['cell_line'], _ = df['experiment'].str.split('-').str\ntypes_select = [1,2,3,4,5]\nfig, axes = plt.subplots(figsize=(25, 25), nrows=len(types_select), ncols=5)\nfor i, sirna in enumerate(types_select):\n    sub_df = df[df['cell_line'] == 'HEPG2']\n    sub_df = sub_df[df['sirna'] == sirna]\n    sub_df_records = sub_df.to_records()\n    np.random.shuffle(sub_df_records)\n    axes[i][0].set_ylabel('Type ' + str(sirna))\n    for j in range(5):\n        exp = sub_df_records[j]['experiment']\n        plate = sub_df_records[j]['plate']\n        well = sub_df_records[j]['well']\n        path = os.path.join('../input/train', exp, 'Plate' + str(plate), well + '_' + 's2' + '_' + 'w3' + '.png')\n        img = Image.open(path)\n        img = transforms.Resize(224)(img)\n        axes[i][j].imshow(img)\n        axes[i][j].set_title(sub_df_records[j]['id_code'])","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Count if there is any cell type that any siran type does not encounter\nThe result shows that all types of the sirans are included in all kinds of cell types"},{"metadata":{"trusted":true},"cell_type":"code","source":"df = pd.read_csv('../input/train.csv')\nincomplete_list = []\ndf['cell_line'], _ = df['experiment'].str.split('-').str\ncell_types = ['HEPG2', 'HUVEC', 'RPE', 'U2OS']\nfor i in range(1, max(df['sirna']) + 1):\n    sub_df = df[df['sirna'] == i]\n    if (len(df['cell_line'].unique()) < 4):\n        incomplete_list.append(i)\nprint('the incomplete list is: ', incomplete_list)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## draw the histgram of different cell types over sirans"},{"metadata":{"trusted":true},"cell_type":"code","source":"import matplotlib.pyplot as plt\n\ndf = pd.read_csv('../input/train.csv')\nincomplete_list = []\ndf['cell_line'], _ = df['experiment'].str.split('-').str\ncell_types = ['HEPG2', 'HUVEC', 'RPE', 'U2OS']\nfig, axes = plt.subplots(nrows=2, ncols=2, figsize=(10, 10))\nfor i, cell_type in enumerate(cell_types):\n    sub_df = df[df['cell_line'] == cell_type]\n    axes[i // 2, i % 2].hist(sub_df['sirna'].tolist(), bins=1108)\n    axes[i // 2, i % 2].set_title(cell_type)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.4","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}