{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "This notebook has been executed using the docker image `colomoto/colomoto-docker:2020-07-01`" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import biolqm\n", "import stablemotifs\n", "from colomoto_jupyter import tabulate\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Model name: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz\r\n" ] } ], "source": [ "!lscpu|grep name" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets first import the T-LGL leukemia model used in Zanudo et al. 2015 (DOI: 10.1371/journal.pcbi.1004571) and display its Boolean rules" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Downloading http://ginsim.org/sites/default/files/SuppMat_Model_Master_Model.zginml" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "model = biolqm.load(\"http://ginsim.org/sites/default/files/SuppMat_Model_Master_Model.zginml\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "target = {\"CellCycleArrest\": 1,\"EMT\":1,\"Invasion\":1,\"Migration\":1,\"Metastasis\":1,\"Apoptosis\":0}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The model contains a large number of cycles, so the algorithm in StableMotifs needs to include a threshold in the maximal cycle length it uses to construct the stable motifs, which are then used to obtain the reprogramming interventions.\n", "\n", "Note: There are more efficient algorithms for finding stable motifs that are not yet implemented (e.g. the one in PyBoolNet: https://github.com/hklarner/PyBoolNet). Using these more efficient algorithms would not require such a threshold and would make the program much faster. Future releases will include these more efficient algorithms." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 21.2 ms, sys: 15.9 ms, total: 37 ms\n", "Wall time: 2min 30s\n" ] } ], "source": [ "fixed = {\"ECMicroenv\": 0, \"DNAdamage\": 0}\n", "%time stm00 = stablemotifs.load(model, fixed, mcl=10, msm=10000, quiet=True) #Max cycle size for SM seems to be 10" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 13.8 ms, sys: 10.6 ms, total: 24.5 ms\n", "Wall time: 1min 11s\n" ] } ], "source": [ "fixed = {\"ECMicroenv\": 1, \"DNAdamage\": 0}\n", "%time stm10 = stablemotifs.load(model,fixed, mcl=5, msm=10000, quiet=True) #Max cycle size for SM seems to be 5" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 125 ms, sys: 274 ms, total: 398 ms\n", "Wall time: 44min 22s\n" ] } ], "source": [ "fixed = {\"ECMicroenv\": 0, \"DNAdamage\": 1}\n", "%time stm01 = stablemotifs.load(model, fixed, mcl=7, msm=10000, quiet=True) #Max cycle size for SM seems to be 7" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 24.4 ms, sys: 35.8 ms, total: 60.2 ms\n", "Wall time: 5min 22s\n" ] } ], "source": [ "fixed = {\"ECMicroenv\": 1, \"DNAdamage\": 1}\n", "%time stm11 = stablemotifs.load(model, fixed, mcl=5, msm=10000, quiet=True) #Max cycle size for SM seems to be 5" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r00 = stm00.reprogramming_to_attractor(target)\n", "r00" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[FromCondition('input', TemporaryPerturbation(SNAI2=1)),\n", " FromCondition('input', TemporaryPerturbation(p53=0))]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r10 = stm10.reprogramming_to_attractor(target)\n", "r10" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SNAI2 p53
00
11
" ], "text/plain": [ "" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r10.as_table()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "target\n", "\n", "\n", "\n", "\n", "\n", "target\n", "\n", "\n", "input\n", "\n", "\n", "input\n", "\n", "\n", "\n", "\n", "input->target\n", "\n", "\n", "\n", "T(SNAI2=1)\n", "\n", "\n", "\n", "\n", "input->target\n", "\n", "\n", "\n", "T(p53=0)\n", "\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r10.as_graph()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r01 = stm01.reprogramming_to_attractor(target)\n", "r01" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[FromCondition('input', TemporaryPerturbation(NICD=1, SNAI2=1)),\n", " FromCondition('input', TemporaryPerturbation(SNAI2=1, p63=0)),\n", " FromCondition('input', TemporaryPerturbation(NICD=1, ZEB1=1, p53=0)),\n", " FromCondition('input', TemporaryPerturbation(NICD=1, miR200=0, p53=0)),\n", " FromCondition('input', TemporaryPerturbation(NICD=1, p53=0, p73=0)),\n", " FromCondition('input', TemporaryPerturbation(ZEB1=1, p53=0, p63=0)),\n", " FromCondition('input', TemporaryPerturbation(p53=0, p63=0, p73=0))]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r11 = stm11.reprogramming_to_attractor(target)\n", "r11" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NICD SNAI2 ZEB1 miR200 p53 p63 p73
0000
1100
210
3100
4100
5110
611
" ], "text/plain": [ "" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r11.as_table()" ] }, { "cell_type": "raw", "metadata": {}, "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As a reprogramming example, consider the case of the environmental signal ECMicroenv=1 DNAdamage=1. Under this threshold, we can identify the two attractors. Specifically, we identify attractors HS and EMT2 (using the terminology of Cohen et al.)." ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CellCycleArrestECMicroenvMetastasisApoptosisDNAdamageMigrationInvasionTGFbetaCTNNB1miR203miR200TWIST1SNAI2SNAI1miR34NICDZEB1ZEB2DKK1SMADAKT1AKT2CDH1CDH2ERKVIMp21EMTp63p53p73GF
100000000000000000000001000000000
010000000000111001100010111010001
\n", "
" ], "text/plain": [ " CellCycleArrest ECMicroenv Metastasis Apoptosis DNAdamage Migration \\\n", "1 0 0 0 0 0 0 \n", "0 1 0 0 0 0 0 \n", "\n", " Invasion TGFbeta CTNNB1 miR203 miR200 TWIST1 SNAI2 SNAI1 miR34 \\\n", "1 0 0 0 0 0 0 0 0 0 \n", "0 0 0 0 0 0 1 1 1 0 \n", "\n", " NICD ZEB1 ZEB2 DKK1 SMAD AKT1 AKT2 CDH1 CDH2 ERK VIM p21 EMT \\\n", "1 0 0 0 0 0 0 0 1 0 0 0 0 0 \n", "0 0 1 1 0 0 0 1 0 1 1 1 0 1 \n", "\n", " p63 p53 p73 GF \n", "1 0 0 0 0 \n", "0 0 0 0 1 " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tabulate(stm00.attractors)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These attractors have the associated stable motfis and reprogramming interventions" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'CDH2': 1,\n", " 'CTNNB1': 0,\n", " 'SNAI1': 1,\n", " 'TWIST1': 1,\n", " 'miR203': 0,\n", " 'miR34': 0,\n", " 'p53': 0},\n", " {'AKT2': 0,\n", " 'CDH1': 1,\n", " 'CTNNB1': 0,\n", " 'SNAI1': 0,\n", " 'SNAI2': 0,\n", " 'TWIST1': 0,\n", " 'ZEB1': 0,\n", " 'ZEB2': 0}]" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm00.stable_motifs" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{0: [{'SNAI1': 1}, {'TWIST1': 1, 'miR34': 0}, {'TWIST1': 1, 'p53': 0}],\n", " 1: [{'CDH1': 1, 'SNAI1': 0},\n", " {'CDH1': 1, 'TWIST1': 0},\n", " {'CTNNB1': 0, 'SNAI1': 0},\n", " {'CTNNB1': 0, 'TWIST1': 0},\n", " {'SNAI2': 0, 'TWIST1': 0, 'ZEB1': 0}]}" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm00.control_sets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now identify reprogramming interventions for each of the attractors with EMT=0, which is only one of them in this case (named HS in the work of Cohen et al.)." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[FromCondition('input', TemporaryPerturbation(CDH1=1, SNAI1=0)),\n", " FromCondition('input', TemporaryPerturbation(CDH1=1, TWIST1=0)),\n", " FromCondition('input', TemporaryPerturbation(CTNNB1=0, SNAI1=0)),\n", " FromCondition('input', TemporaryPerturbation(CTNNB1=0, TWIST1=0)),\n", " FromCondition('input', TemporaryPerturbation(SNAI2=0, TWIST1=0, ZEB1=0))]" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm00.reprogramming_to_attractor(EMT=0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As another reprogramming example, consider the case of the environmental signal ECMicroenv=1 DNAdamage=1. Under this threshold, we can identify two of the three attractors. Specifically, we identify attractors Apo3 and M1." ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CellCycleArrestECMicroenvMetastasisApoptosisDNAdamageMigrationInvasionTGFbetaCTNNB1miR203miR200TWIST1SNAI2SNAI1miR34NICDZEB1ZEB2DKK1SMADAKT1AKT2CDH1CDH2ERKVIMp21EMTp63p53p73GF
011011001011000000000001000100100
111101111000111011111010111010001
\n", "
" ], "text/plain": [ " CellCycleArrest ECMicroenv Metastasis Apoptosis DNAdamage Migration \\\n", "0 1 1 0 1 1 0 \n", "1 1 1 1 0 1 1 \n", "\n", " Invasion TGFbeta CTNNB1 miR203 miR200 TWIST1 SNAI2 SNAI1 miR34 \\\n", "0 0 1 0 1 1 0 0 0 0 \n", "1 1 1 0 0 0 1 1 1 0 \n", "\n", " NICD ZEB1 ZEB2 DKK1 SMAD AKT1 AKT2 CDH1 CDH2 ERK VIM p21 EMT \\\n", "0 0 0 0 0 0 0 0 1 0 0 0 1 0 \n", "1 1 1 1 1 1 0 1 0 1 1 1 0 1 \n", "\n", " p63 p53 p73 GF \n", "0 0 1 0 0 \n", "1 0 0 0 1 " ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tabulate(stm11.attractors)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These attractors have the associated stable motfis and reprogramming interventions" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'AKT1': 0, 'AKT2': 0, 'SNAI2': 0, 'p53': 1, 'p73': 0},\n", " {'NICD': 1,\n", " 'SNAI2': 1,\n", " 'ZEB1': 1,\n", " 'miR200': 0,\n", " 'miR203': 0,\n", " 'miR34': 0,\n", " 'p53': 0,\n", " 'p63': 0,\n", " 'p73': 0}]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm11.stable_motifs" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{0: [{'p53': 1}, {'AKT1': 0, 'AKT2': 0, 'SNAI2': 0, 'p73': 0}],\n", " 1: [{'NICD': 1, 'SNAI2': 1},\n", " {'SNAI2': 1, 'p63': 0},\n", " {'NICD': 1, 'ZEB1': 1, 'p53': 0},\n", " {'NICD': 1, 'miR200': 0, 'p53': 0},\n", " {'NICD': 1, 'p53': 0, 'p73': 0},\n", " {'ZEB1': 1, 'p53': 0, 'p63': 0},\n", " {'p53': 0, 'p63': 0, 'p73': 0}]}" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm11.control_sets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now identify reprogramming interventions for each of the attractors with Apoptosis=1, which is only one of them in this case (Apo3 in the work of Cohen et al.).\n", "\n", "Note that because of the threshold in the cycle length, we cannot guarantee that the intervention will reprogram the system to the target attractor with 100% effectiveness. We still expect the intervention to be very effective, even if not necessarily 100% effective. This is because any motifs we miss involve long cycles, which are expected to be associated with a smaller basin of attraction." ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[FromCondition('input', TemporaryPerturbation(p53=1)),\n", " FromCondition('input', TemporaryPerturbation(AKT1=0, AKT2=0, SNAI2=0, p73=0))]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "stm11.reprogramming_to_attractor(Apoptosis=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 2 }