{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 2.1 CCLE Gene Expression\n", "This notebook uses Clustergrammer2 to visualize the Cancer cell line Encyclopedia gene expression data (data obtained from the [Broad-Institute](https://portals.broadinstitute.org/ccle)). The CCLE project measured genetic data from over 1000 cancer cell lines and provides cell line annotations (e.g. tissue) that is used to generate cell type categories. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ ">> clustergrammer2 backend version 0.14.0\n" ] } ], "source": [ "from clustergrammer2 import Network, CGM2\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "df = {}" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "df['ini'] = pd.read_csv('../data/CCLE/CCLE.txt.gz', compression='gzip', index_col=0)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from ast import literal_eval as make_tuple\n", "cols = df['ini'].columns.tolist()\n", "new_cols = [make_tuple(x) for x in cols]\n", "df['ini'].columns = new_cols" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "n1 = Network(CGM2)\n", "n2 = Network(CGM2)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from copy import deepcopy\n", "df['meta_col'] = n1.make_df_from_cols(df['ini'].columns.tolist())\n", "df['clean'] = deepcopy(df['ini'])\n", "df['clean'].columns = df['meta_col'].index.tolist()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | color | \n", "
---|---|
Cat | \n", "red | \n", "
Dog | \n", "yellow | \n", "
Shark | \n", "black | \n", "
Snake | \n", "blue | \n", "
Lizard | \n", "green | \n", "