diff --git a/notebooks/Plotting lineage feature values.ipynb b/notebooks/Plotting lineage feature values.ipynb new file mode 100644 index 0000000..6de01d3 --- /dev/null +++ b/notebooks/Plotting lineage feature values.ipynb @@ -0,0 +1,10492 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Loading and plotting data in lineages made with TrackMate\n", + "\n", + "In this example, we will see how to extract numerical data from a TrackMate file and plot it interactively. \n", + "This is a simple notebook, that will introduce the use of plotly to explore that data stored in a pycellin lineage.\n", + "\n", + "To run this notebook, create or use a Python environment with pycellin and dependencies for the jupyter.\n", + "For instance:\n", + "``` bash\n", + "> conda create -n pycellin python=\"3.10\" \n", + "> conda activate pycellin\n", + "> pip install pycellin\n", + "> pip install ipykernel\n", + "> pip install --upgrade nbformat\n", + "```\n", + "and restart the kernel.\n", + "\n", + "The data used in this demo contain the tracking of an early _C.elegans_ embryo, imaged in 3D for 37 minutes just after the first cell division (zygote -> AB & P1).\n", + "\n", + "\n", + "\n", + "We want to plot various cell numerical features over time. \n", + "We will see first a rather verbose way of plotting feature values, along with the hierarchy of the lineage. The data points will be connected by a line if the cells are linked in the lineage graph. \n", + "In a second step will rely on pycellin to export all feature values to a Pandas dataframe. This can then be used to very quickly plot feature using Plotly express.\n", + "\n", + "\n", + "Cell tracking was done with TrackMate, on a 3D+T movie. \n", + "Let's load and display the lineage with pycellin." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CellLineage of ID 0 named AB with 25 cells and 24 links.\n", + "CellLineage of ID 1 named P1 with 28 cells and 27 links.\n", + "CellLineage of ID 2 named PB1 with 17 cells and 16 links.\n", + "CellLineage of ID 3 named PB2 with 17 cells and 16 links.\n" + ] + } + ], + "source": [ + "import pycellin\n", + "\n", + "xml_path = \"imgs/Celegans-5pc-17timepoints.xml\"\n", + "model = pycellin.load_TrackMate_XML(xml_path)\n", + "\n", + "# Get the lineages.\n", + "cell_lins = model.get_cell_lineages()\n", + "for lin in cell_lins:\n", + " print(lin)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We find 4 lineages. In the _C.elegans_ embryo:\n", + "- PB1 and PB2 are the polar bodies. They don't divide. By convention, PB1 is the one that does not move and is used to identify the anterior side of the embryo.\n", + "- The AB cell primarily gives rise to ectodermal tissues, including the nervous system, hypodermis (skin), and parts of the pharynx. When P0 divides in AB and P1, AB goes on the anterior side.\n", + "- The P1 lineage primarily contributes to the mesodermal and endodermal tissues, as well as the germline. This cell goes on the posterior side.\n", + "\n", + "Let's plot the lineages that were tracked.\n", + "\n", + "pycellin includes a `plot()` function that can directly diplay the lineages hierarchy.\n", + "These plots reproduce what is shown in TrackScheme: The position of cells is discarded, and they are simply shown with their relationship over time. The time is in the Y axis, from top to bottom. The X axis is simply used to stack sibblings.\n", + "\n", + "pycellin generates an interactive plot thanks to plotly. You can hover the mouse over a node to show information. Additionnally, you can specify a feature to map the node color on a color map.\n", + "In the example below we show the cell name and radius in the hover, and use the radius to generate node colors.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "dash": "solid", + "width": 1 + }, + "mode": "lines", + "name": "Edges", + "text": [], + "type": "scatter", + "x": [ + 0.5, + 0.5, + null, + 0, + 0, + null, + 0, + 0, + null, + -0.5, + -0.5, + null, + 0, + -0.5, + null, + 0, + 0.5, + null, + 0.5, + 0.5, + null, + 0, + 0, + null, + 0, + 0, + null, + -0.5, + -0.5, + null, + 0.5, + 0.5, + null, + 0, + 0, + null, + 0, + 0, + null, + 0.5, + 0.5, + null, + -0.5, + -0.5, + null, + 0.5, + 0.5, + null, + 0, + 0, + null, + -0.5, + -0.5, + null, + -0.5, + -0.5, + null, + 0.5, + 0.5, + null, + 0, + 0, + null, + 0.5, + 0.5, + null, + -0.5, + -0.5, + null, + -0.5, + -0.5, + null + ], + "y": [ + 14, + 15, + null, + 3, + 4, + null, + 7, + 8, + null, + 10, + 11, + null, + 8, + 9, + null, + 8, + 9, + null, + 10, + 11, + null, + 6, + 7, + null, + 4, + 5, + null, + 15, + 16, + null, + 15, + 16, + null, + 5, + 6, + null, + 1, + 2, + null, + 11, + 12, + null, + 11, + 12, + null, + 12, + 13, + null, + 0, + 1, + null, + 12, + 13, + null, + 9, + 10, + null, + 9, + 10, + null, + 2, + 3, + null, + 13, + 14, + null, + 13, + 14, + null, + 14, + 15, + null + ] + }, + { + "hoverinfo": "text", + "hovertemplate": "%{text}", + "marker": { + "color": [ + 3.7164913424570605, + 4.057923247260989, + 4.913372637273821, + 2.714467152400909, + 3.0257962120355084, + 2.564698042074024, + 4.706380674887512, + 4.549509990320446, + 3.9781298468569273, + 3.8369072817429455, + 4.689480221535761, + 2.832224904521457, + 3.0220255319842173, + 3.137032766315005, + 3.2616514518859323, + 2.4463858994404535, + 3.4027765795751685, + 2.2976929804194706, + 2.3241055578268184, + 4.020847603630397, + 3.518451840596407, + 4.325261660019269, + 3.44897858931206, + 3.6712366076755414, + 3.880691669488799 + ], + "colorbar": { + "title": { + "text": "RADIUS" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "size": 10, + "symbol": "circle" + }, + "mode": "markers", + "name": "lineage_ID: 0", + "text": [ + "name: EMS
RADIUS: 3.7164913424570605
", + "name: P1
RADIUS: 4.057923247260989
", + "name: P1
RADIUS: 4.913372637273821
", + "name: P2
RADIUS: 2.714467152400909
", + "name: P1
RADIUS: 3.0257962120355084
", + "name: EMS
RADIUS: 2.564698042074024
", + "name: P1
RADIUS: 4.706380674887512
", + "name: P1
RADIUS: 4.549509990320446
", + "name: P2
RADIUS: 3.9781298468569273
", + "name: EMS
RADIUS: 3.8369072817429455
", + "name: P1
RADIUS: 4.689480221535761
", + "name: P1
RADIUS: 2.832224904521457
", + "name: EMS
RADIUS: 3.0220255319842173
", + "name: P2
RADIUS: 3.137032766315005
", + "name: EMS
RADIUS: 3.2616514518859323
", + "name: P1
RADIUS: 2.4463858994404535
", + "name: P2
RADIUS: 3.4027765795751685
", + "name: P2
RADIUS: 2.2976929804194706
", + "name: EMS
RADIUS: 2.3241055578268184
", + "name: P2
RADIUS: 4.020847603630397
", + "name: P1
RADIUS: 3.518451840596407
", + "name: EMS
RADIUS: 4.325261660019269
", + "name: EMS
RADIUS: 3.44897858931206
", + "name: P2
RADIUS: 3.6712366076755414
", + "name: P2
RADIUS: 3.880691669488799
" + ], + "type": "scatter", + "x": [ + 0.5, + 0, + 0, + -0.5, + 0, + 0.5, + 0, + 0, + -0.5, + 0.5, + 0, + 0, + 0.5, + -0.5, + 0.5, + 0, + -0.5, + -0.5, + 0.5, + -0.5, + 0, + 0.5, + 0.5, + -0.5, + -0.5 + ], + "y": [ + 14, + 3, + 7, + 10, + 8, + 10, + 6, + 4, + 15, + 15, + 5, + 1, + 11, + 11, + 12, + 0, + 12, + 9, + 9, + 16, + 2, + 16, + 13, + 13, + 14 + ] + } + ], + "layout": { + "hovermode": "closest", + "plot_bgcolor": "white", + "showlegend": true, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "P1 lineage" + }, + "xaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + }, + "yaxis": { + "autorange": "reversed", + "showgrid": true, + "title": { + "text": "Time (frames)" + }, + "zeroline": true + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "dash": "solid", + "width": 1 + }, + "mode": "lines", + "name": "Edges", + "text": [], + "type": "scatter", + "x": [ + 1, + 1, + null, + 0, + 0, + null, + 0, + 1, + null, + 0, + -1, + null, + -1, + -1, + null, + 1, + 1, + null, + -1, + -1, + null, + 1, + 1, + null, + 0, + 0, + null, + 0, + 0, + null, + -1, + -0.5, + null, + -1, + -1.5, + null, + 1, + 1.5, + null, + 1, + 0.5, + null, + 0, + 0, + null, + 0, + 0, + null, + -1, + -1, + null, + -1, + -1, + null, + 1, + 1, + null, + 1, + 1, + null, + 0, + 0, + null, + -1, + -1, + null, + 1, + 1, + null, + 0, + 0, + null, + -1, + -1, + null, + 1, + 1, + null, + -1, + -1, + null + ], + "y": [ + 14, + 15, + null, + 3, + 4, + null, + 7, + 8, + null, + 7, + 8, + null, + 8, + 9, + null, + 8, + 9, + null, + 10, + 11, + null, + 10, + 11, + null, + 6, + 7, + null, + 4, + 5, + null, + 15, + 16, + null, + 15, + 16, + null, + 15, + 16, + null, + 15, + 16, + null, + 1, + 2, + null, + 5, + 6, + null, + 12, + 13, + null, + 11, + 12, + null, + 11, + 12, + null, + 12, + 13, + null, + 0, + 1, + null, + 9, + 10, + null, + 9, + 10, + null, + 2, + 3, + null, + 13, + 14, + null, + 13, + 14, + null, + 14, + 15, + null + ] + }, + { + "hoverinfo": "text", + "hovertemplate": "%{text}", + "marker": { + "color": [ + 4.27062378462962, + 3.4993584983813997, + 2.8901529540990007, + 2.1776799509036318, + 2.287555090792667, + 2.988710790245092, + 3.2122928752545405, + 3.5176920798643874, + 4.149130354188847, + 2.974962103169778, + 2.904232202082756, + 2.6169960037264794, + 4.28791186899909, + 3.9759499406559855, + 3.4985904214255643, + 3.622928350613548, + 4.062106676251701, + 2.3448113751321205, + 2.693028355359231, + 2.724638552920792, + 2.3059751585497934, + 1.857033661545671, + 3.0268229498856147, + 1.845104273954396, + 1.79786986223616, + 4.176263811303821, + 4.214903791181496, + 4.380023904468677 + ], + "colorbar": { + "title": { + "text": "RADIUS" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "size": 10, + "symbol": "circle" + }, + "mode": "markers", + "name": "lineage_ID: 1", + "text": [ + "name: AB.p
RADIUS: 4.27062378462962
", + "name: AB
RADIUS: 3.4993584983813997
", + "name: AB
RADIUS: 2.8901529540990007
", + "name: AB.a
RADIUS: 2.1776799509036318
", + "name: AB.p
RADIUS: 2.287555090792667
", + "name: AB.a
RADIUS: 2.988710790245092
", + "name: AB.p
RADIUS: 3.2122928752545405
", + "name: AB
RADIUS: 3.5176920798643874
", + "name: AB
RADIUS: 4.149130354188847
", + "name: AB.a
RADIUS: 2.974962103169778
", + "name: AB.p
RADIUS: 2.904232202082756
", + "name: AB
RADIUS: 2.6169960037264794
", + "name: AB
RADIUS: 4.28791186899909
", + "name: AB.a
RADIUS: 3.9759499406559855
", + "name: AB.a
RADIUS: 3.4985904214255643
", + "name: AB.p
RADIUS: 3.622928350613548
", + "name: AB.p
RADIUS: 4.062106676251701
", + "name: AB
RADIUS: 2.3448113751321205
", + "name: AB.a
RADIUS: 2.693028355359231
", + "name: AB.p
RADIUS: 2.724638552920792
", + "name: AB.al
RADIUS: 2.3059751585497934
", + "name: AB.pl
RADIUS: 1.857033661545671
", + "name: AB
RADIUS: 3.0268229498856147
", + "name: AB.ar
RADIUS: 1.845104273954396
", + "name: AB.pr
RADIUS: 1.79786986223616
", + "name: AB.a
RADIUS: 4.176263811303821
", + "name: AB.p
RADIUS: 4.214903791181496
", + "name: AB.a
RADIUS: 4.380023904468677
" + ], + "type": "scatter", + "x": [ + 1, + 0, + 0, + -1, + 1, + -1, + 1, + 0, + 0, + -1, + 1, + 0, + 0, + -1, + -1, + 1, + 1, + 0, + -1, + 1, + -1.5, + 0.5, + 0, + -0.5, + 1.5, + -1, + 1, + -1 + ], + "y": [ + 14, + 3, + 7, + 8, + 8, + 10, + 10, + 6, + 4, + 15, + 15, + 1, + 5, + 12, + 11, + 11, + 12, + 0, + 9, + 9, + 16, + 16, + 2, + 16, + 16, + 13, + 13, + 14 + ] + } + ], + "layout": { + "hovermode": "closest", + "plot_bgcolor": "white", + "showlegend": true, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "AB lineage" + }, + "xaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + }, + "yaxis": { + "autorange": "reversed", + "showgrid": true, + "title": { + "text": "Time (frames)" + }, + "zeroline": true + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "dash": "solid", + "width": 1 + }, + "mode": "lines", + "name": "Edges", + "text": [], + "type": "scatter", + "x": [ + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null + ], + "y": [ + 14, + 15, + null, + 0, + 1, + null, + 12, + 13, + null, + 3, + 4, + null, + 7, + 8, + null, + 9, + 10, + null, + 15, + 16, + null, + 8, + 9, + null, + 2, + 3, + null, + 10, + 11, + null, + 1, + 2, + null, + 5, + 6, + null, + 4, + 5, + null, + 6, + 7, + null, + 13, + 14, + null, + 11, + 12, + null + ] + }, + { + "hoverinfo": "text", + "hovertemplate": "%{text}", + "marker": { + "color": [ + 1.7682942553669216, + 1.7981911722638388, + 1.6808381114092394, + 1.8758918564501623, + 1.8579052084742582, + 1.7662871091977164, + 1.70274074527743, + 1.7890996258778058, + 1.923655892592761, + 1.785173996970351, + 1.95941046399321, + 1.6617615322136614, + 1.833056539364491, + 1.8882801805321134, + 1.8227371692742445, + 1.7722949347397128, + 1.7612491836342503 + ], + "colorbar": { + "title": { + "text": "RADIUS" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "size": 10, + "symbol": "circle" + }, + "mode": "markers", + "name": "lineage_ID: 2", + "text": [ + "name: PB1
RADIUS: 1.7682942553669216
", + "name: PB1
RADIUS: 1.7981911722638388
", + "name: PB1
RADIUS: 1.6808381114092394
", + "name: PB1
RADIUS: 1.8758918564501623
", + "name: PB1
RADIUS: 1.8579052084742582
", + "name: PB1
RADIUS: 1.7662871091977164
", + "name: PB1
RADIUS: 1.70274074527743
", + "name: PB1
RADIUS: 1.7890996258778058
", + "name: PB1
RADIUS: 1.923655892592761
", + "name: PB1
RADIUS: 1.785173996970351
", + "name: PB1
RADIUS: 1.95941046399321
", + "name: PB1
RADIUS: 1.6617615322136614
", + "name: PB1
RADIUS: 1.833056539364491
", + "name: PB1
RADIUS: 1.8882801805321134
", + "name: PB1
RADIUS: 1.8227371692742445
", + "name: PB1
RADIUS: 1.7722949347397128
", + "name: PB1
RADIUS: 1.7612491836342503
" + ], + "type": "scatter", + "x": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "y": [ + 14, + 0, + 12, + 3, + 7, + 9, + 15, + 8, + 2, + 10, + 1, + 16, + 5, + 4, + 6, + 13, + 11 + ] + } + ], + "layout": { + "hovermode": "closest", + "plot_bgcolor": "white", + "showlegend": true, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "PB1 lineage" + }, + "xaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + }, + "yaxis": { + "autorange": "reversed", + "showgrid": true, + "title": { + "text": "Time (frames)" + }, + "zeroline": true + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "dash": "solid", + "width": 1 + }, + "mode": "lines", + "name": "Edges", + "text": [], + "type": "scatter", + "x": [ + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null, + 0, + 0, + null + ], + "y": [ + 14, + 15, + null, + 0, + 1, + null, + 3, + 4, + null, + 12, + 13, + null, + 8, + 9, + null, + 9, + 10, + null, + 15, + 16, + null, + 1, + 2, + null, + 2, + 3, + null, + 5, + 6, + null, + 10, + 11, + null, + 4, + 5, + null, + 6, + 7, + null, + 7, + 8, + null, + 13, + 14, + null, + 11, + 12, + null + ] + }, + { + "hoverinfo": "text", + "hovertemplate": "%{text}", + "marker": { + "color": [ + 1.0095616378789627, + 1.6791112061101958, + 1.9421133782783453, + 0.8469438830981862, + 1.383813521708876, + 1.230222948616314, + 1.1028605544021297, + 1.986784565869501, + 1.9245025722322755, + 1.8758918564501623, + 0.9207070277780156, + 1.1028605544021297, + 1.8900367212477913, + 1.770296855328959, + 1.381806739811918, + 1.044936516483969, + 0.9633643412813312 + ], + "colorbar": { + "title": { + "text": "RADIUS" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "size": 10, + "symbol": "circle" + }, + "mode": "markers", + "name": "lineage_ID: 3", + "text": [ + "name: PB2
RADIUS: 1.0095616378789627
", + "name: PB2
RADIUS: 1.6791112061101958
", + "name: PB2
RADIUS: 1.9421133782783453
", + "name: PB2
RADIUS: 0.8469438830981862
", + "name: PB2
RADIUS: 1.383813521708876
", + "name: PB2
RADIUS: 1.230222948616314
", + "name: PB2
RADIUS: 1.1028605544021297
", + "name: PB2
RADIUS: 1.986784565869501
", + "name: PB2
RADIUS: 1.9245025722322755
", + "name: PB2
RADIUS: 1.8758918564501623
", + "name: PB2
RADIUS: 0.9207070277780156
", + "name: PB2
RADIUS: 1.1028605544021297
", + "name: PB2
RADIUS: 1.8900367212477913
", + "name: PB2
RADIUS: 1.770296855328959
", + "name: PB2
RADIUS: 1.381806739811918
", + "name: PB2
RADIUS: 1.044936516483969
", + "name: PB2
RADIUS: 0.9633643412813312
" + ], + "type": "scatter", + "x": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "y": [ + 14, + 0, + 3, + 12, + 8, + 9, + 15, + 1, + 2, + 5, + 10, + 16, + 4, + 6, + 7, + 13, + 11 + ] + } + ], + "layout": { + "hovermode": "closest", + "plot_bgcolor": "white", + "showlegend": true, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "PB2 lineage" + }, + "xaxis": { + "showgrid": false, + "showticklabels": false, + "zeroline": false + }, + "yaxis": { + "autorange": "reversed", + "showgrid": true, + "title": { + "text": "Time (frames)" + }, + "zeroline": true + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "for lin in cell_lins:\n", + " first_cell = lin.get_root()\n", + " lineage_name = lin.nodes[first_cell][\"name\"]\n", + " lin.plot(\n", + " title=f\"{lineage_name} lineage\",\n", + " node_colormap_feature=\"RADIUS\", \n", + " node_hover_features=[\"name\", \"RADIUS\"], \n", + " node_color_scale=\"jet\",\n", + " node_marker_style=dict(\n", + " size=10,\n", + " symbol=\"circle\",\n", + " ), # style of the nodes\n", + " edge_line_style=dict(\n", + " color=\"black\",\n", + " width=1,\n", + " dash=\"solid\",\n", + " ), \n", + " plot_bgcolor=\"white\",\n", + " )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's focus on the AB lineage and plot the radius of cells as they move and divide.\n", + "\n", + "Because we have 3 cell divisions, we cannot simply collect the time and radius of all cells in the lineage and plot them as a single line. The solution is to loop over edges and plot them one by one." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 28, + 30 + ], + "y": [ + 4.27062378462962, + 2.904232202082756 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 6, + 8 + ], + "y": [ + 3.4993584983813997, + 4.149130354188847 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB.p" + ], + "type": "scatter", + "x": [ + 14, + 16 + ], + "y": [ + 2.8901529540990007, + 2.287555090792667 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB.a" + ], + "type": "scatter", + "x": [ + 14, + 16 + ], + "y": [ + 2.8901529540990007, + 2.1776799509036318 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 16, + 18 + ], + "y": [ + 2.1776799509036318, + 2.693028355359231 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 16, + 18 + ], + "y": [ + 2.287555090792667, + 2.724638552920792 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 20, + 22 + ], + "y": [ + 2.988710790245092, + 3.4985904214255643 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 20, + 22 + ], + "y": [ + 3.2122928752545405, + 3.622928350613548 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 12, + 14 + ], + "y": [ + 3.5176920798643874, + 2.8901529540990007 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 8, + 10 + ], + "y": [ + 4.149130354188847, + 4.28791186899909 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.ar" + ], + "type": "scatter", + "x": [ + 30, + 32 + ], + "y": [ + 2.974962103169778, + 1.845104273954396 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.al" + ], + "type": "scatter", + "x": [ + 30, + 32 + ], + "y": [ + 2.974962103169778, + 2.3059751585497934 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.pr" + ], + "type": "scatter", + "x": [ + 30, + 32 + ], + "y": [ + 2.904232202082756, + 1.79786986223616 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.pl" + ], + "type": "scatter", + "x": [ + 30, + 32 + ], + "y": [ + 2.904232202082756, + 1.857033661545671 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 2, + 4 + ], + "y": [ + 2.6169960037264794, + 3.0268229498856147 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 10, + 12 + ], + "y": [ + 4.28791186899909, + 3.5176920798643874 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 24, + 26 + ], + "y": [ + 3.9759499406559855, + 4.176263811303821 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 22, + 24 + ], + "y": [ + 3.4985904214255643, + 3.9759499406559855 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 22, + 24 + ], + "y": [ + 3.622928350613548, + 4.062106676251701 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 24, + 26 + ], + "y": [ + 4.062106676251701, + 4.214903791181496 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 0, + 2 + ], + "y": [ + 2.3448113751321205, + 2.6169960037264794 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 18, + 20 + ], + "y": [ + 2.693028355359231, + 2.988710790245092 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 18, + 20 + ], + "y": [ + 2.724638552920792, + 3.2122928752545405 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 4, + 6 + ], + "y": [ + 3.0268229498856147, + 3.4993584983813997 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 26, + 28 + ], + "y": [ + 4.176263811303821, + 4.380023904468677 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 26, + 28 + ], + "y": [ + 4.214903791181496, + 4.27062378462962 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "size": 10, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 28, + 30 + ], + "y": [ + 4.380023904468677, + 2.974962103169778 + ] + } + ], + "layout": { + "paper_bgcolor": "rgba(0, 0, 0, 0)", + "plot_bgcolor": "rgba(0, 0, 0, 0)", + "showlegend": false, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Radius of the AB lineage cells over time" + }, + "xaxis": { + "linecolor": "black", + "title": { + "text": "Time (min)" + } + }, + "yaxis": { + "linecolor": "black", + "title": { + "text": "Radius (µm)" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Search for the AB lineage\n", + "for lin in cell_lins:\n", + " first_cell = lin.get_root()\n", + " lineage_name = lin.nodes[first_cell][\"name\"]\n", + "\n", + " if lineage_name == 'AB':\n", + " ab_lineage = lin\n", + " ab_lineage_ID = lin.graph[\"lineage_ID\"]\n", + " break\n", + "\n", + "\n", + "# Let's create a figure with plotly, that is already shipped with pycellin.\n", + "import plotly.graph_objects as go\n", + "\n", + "fig = go.Figure()\n", + "\n", + "# Loop over the edges of the lineage and add a line for each edge.\n", + "for source, target in ab_lineage.edges():\n", + " # The time is stored in the node attributes. In TrackMate, this is the attribute \"POSITION_T\".\n", + " source_time = ab_lineage.nodes[source][\"POSITION_T\"]\n", + " target_time = ab_lineage.nodes[target][\"POSITION_T\"]\n", + " # And for the radius.\n", + " source_radius = ab_lineage.nodes[source][\"RADIUS\"]\n", + " target_radius = ab_lineage.nodes[target][\"RADIUS\"]\n", + " # Cell names\n", + " source_name = ab_lineage.nodes[source][\"name\"]\n", + " target_name = ab_lineage.nodes[target][\"name\"]\n", + "\n", + " fig.add_trace(\n", + " go.Scatter(\n", + " x=[source_time, target_time],\n", + " y=[source_radius, target_radius],\n", + " mode=\"lines+markers\",\n", + " line=dict(color=\"black\", width=1),\n", + " marker=dict(size=10, symbol=\"circle\"),\n", + " text=[source_name, target_name]\n", + " )\n", + " )\n", + "# Add axis labels\n", + "fig.update_layout(\n", + " title=\"Radius of the AB lineage cells over time\",\n", + " xaxis_title=\"Time (min)\",\n", + " yaxis_title=\"Radius (µm)\",\n", + " showlegend=False,\n", + " # Transparent background:\n", + " plot_bgcolor='rgba(0, 0, 0, 0)',\n", + " paper_bgcolor='rgba(0, 0, 0, 0)',\n", + ")\n", + "\n", + "# Axes colors\n", + "fig.update_xaxes(linecolor='black')\n", + "fig.update_yaxes(linecolor='black')\n", + "\n", + "# Show the figure\n", + "fig.show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can generalize this approach and package this in a function.\n", + "We can even add a third feature that will be used to color the nodes with a colormap." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def plot_lineage_features(lineage, x_feature, y_feature, c_feature):\n", + " fig = go.Figure()\n", + "\n", + " # Prepare the color scale. Collect all the values for the feature c_feature\n", + " # and create a color scale.\n", + " c_values = [lineage.nodes[n][c_feature] for n in lineage.nodes()]\n", + " c_min = min(c_values)\n", + " c_max = max(c_values)\n", + " \n", + "\n", + " # Loop over the edges of the lineage and add a line for each edge.\n", + " for source, target in lineage.edges():\n", + " source_x = lineage.nodes[source][x_feature]\n", + " target_x = lineage.nodes[target][x_feature]\n", + " source_y = lineage.nodes[source][y_feature]\n", + " target_y = lineage.nodes[target][y_feature]\n", + " # Cell names\n", + " source_name = ab_lineage.nodes[source][\"name\"]\n", + " target_name = ab_lineage.nodes[target][\"name\"]\n", + " # For the colormap\n", + " data = [ lineage.nodes[source][c_feature] , lineage.nodes[target][c_feature] ]\n", + "\n", + " fig.add_trace(\n", + " go.Scatter(\n", + " x=[source_x, target_x],\n", + " y=[source_y, target_y],\n", + " mode=\"lines+markers\",\n", + " line=dict(color=\"black\", width=1),\n", + " marker=dict(\n", + " color=data,\n", + " colorscale='jet', # Apply the custom colormap\n", + " cmin=c_min, # Minimum value of the scale\n", + " cmax=c_max,\n", + " size=15,\n", + " symbol=\"circle\",\n", + " line=dict(color='black', width=1)\n", + " ),\n", + " text=[source_name, target_name]\n", + " )\n", + " )\n", + " # Add axis labels\n", + " fig.update_layout(\n", + " xaxis_title=x_feature,\n", + " yaxis_title=y_feature,\n", + " showlegend=False,\n", + " # Transparent background:\n", + " plot_bgcolor='rgba(0, 0, 0, 0)',\n", + " paper_bgcolor='rgba(0, 0, 0, 0)',\n", + " )\n", + "\n", + " return fig\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can use it to plot the cell position over time.\n", + "There is a gotcha, however.\n", + "In TrackMate, the X and Y position of a cell is stored in the feature \"POSITION_X\" and \"POSITION_Y\". But when pycellin loads a TrackMate file, these feature values are reinterpreted and stored in the node attributes \"cell_x\" and \"cell_y\".\n", + "So we have:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 28, + 30 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 35.16405135095305, + 32.49222155368604 + ], + "y": [ + 29.35022331824101, + 30.825787733553906 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 6, + 8 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 20.62981335932797, + 19.549326607823197 + ], + "y": [ + 21.93942294490435, + 20.785928247744163 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 14, + 16 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB.p" + ], + "type": "scatter", + "x": [ + 20.938227070011678, + 27.642048657238682 + ], + "y": [ + 21.335160284609056, + 22.06565147745902 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 14, + 16 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB.a" + ], + "type": "scatter", + "x": [ + 20.938227070011678, + 20.442060551764957 + ], + "y": [ + 21.335160284609056, + 18.854327693375446 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 16, + 18 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 20.442060551764957, + 18.92484688268042 + ], + "y": [ + 18.854327693375446, + 19.068560786087847 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 16, + 18 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 27.642048657238682, + 28.643224842673355 + ], + "y": [ + 22.06565147745902, + 22.67086546385567 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 20, + 22 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 18.94415847547436, + 18.410893848565575 + ], + "y": [ + 17.024226491377426, + 14.028590782354119 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 20, + 22 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 33.32110764956728, + 35.99082231020928 + ], + "y": [ + 24.37265652020072, + 26.06596135447305 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 12, + 14 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 20.762333949155583, + 20.938227070011678 + ], + "y": [ + 20.769579759618637, + 21.335160284609056 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 8, + 10 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 19.549326607823197, + 20.78719928440032 + ], + "y": [ + 20.785928247744163, + 21.115128424537335 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 30, + 32 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.ar" + ], + "type": "scatter", + "x": [ + 21.09395247580997, + 21.74457193858749 + ], + "y": [ + 15.718271774331448, + 16.268022578801965 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 30, + 32 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.al" + ], + "type": "scatter", + "x": [ + 21.09395247580997, + 19.367236026655032 + ], + "y": [ + 15.718271774331448, + 14.744668697762565 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 30, + 32 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.pr" + ], + "type": "scatter", + "x": [ + 32.49222155368604, + 32.16572069099786 + ], + "y": [ + 30.825787733553906, + 32.17728185258808 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 30, + 32 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.pl" + ], + "type": "scatter", + "x": [ + 32.49222155368604, + 32.84622350793301 + ], + "y": [ + 30.825787733553906, + 29.174591272907268 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 2, + 4 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 24.103384185467213, + 21.564416472388977 + ], + "y": [ + 28.151020050585068, + 26.491691544198478 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 10, + 12 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 20.78719928440032, + 20.762333949155583 + ], + "y": [ + 21.115128424537335, + 20.769579759618637 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 24, + 26 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 19.1798497484047, + 19.879226061378912 + ], + "y": [ + 12.185891258045276, + 13.406667854667385 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 22, + 24 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 18.410893848565575, + 19.1798497484047 + ], + "y": [ + 14.028590782354119, + 12.185891258045276 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 22, + 24 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 35.99082231020928, + 36.94051611035411 + ], + "y": [ + 26.06596135447305, + 28.92684213265141 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 24, + 26 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 36.94051611035411, + 36.236692638985815 + ], + "y": [ + 28.92684213265141, + 30.45962703903977 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 0, + 2 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 24.987105095424283, + 24.103384185467213 + ], + "y": [ + 28.91981284194761, + 28.151020050585068 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 18, + 20 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 18.92484688268042, + 18.94415847547436 + ], + "y": [ + 19.068560786087847, + 17.024226491377426 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 18, + 20 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 28.643224842673355, + 33.32110764956728 + ], + "y": [ + 22.67086546385567, + 24.37265652020072 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 4, + 6 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB", + "AB" + ], + "type": "scatter", + "x": [ + 21.564416472388977, + 20.62981335932797 + ], + "y": [ + 26.491691544198478, + 21.93942294490435 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 26, + 28 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 19.879226061378912, + 20.494231328459744 + ], + "y": [ + 13.406667854667385, + 13.947165314658333 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 26, + 28 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.p", + "AB.p" + ], + "type": "scatter", + "x": [ + 36.236692638985815, + 35.16405135095305 + ], + "y": [ + 30.45962703903977, + 29.35022331824101 + ] + }, + { + "line": { + "color": "black", + "width": 1 + }, + "marker": { + "cmax": 32, + "cmin": 0, + "color": [ + 28, + 30 + ], + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ], + "line": { + "color": "black", + "width": 1 + }, + "size": 15, + "symbol": "circle" + }, + "mode": "lines+markers", + "text": [ + "AB.a", + "AB.a" + ], + "type": "scatter", + "x": [ + 20.494231328459744, + 21.09395247580997 + ], + "y": [ + 13.947165314658333, + 15.718271774331448 + ] + } + ], + "layout": { + "paper_bgcolor": "rgba(0, 0, 0, 0)", + "plot_bgcolor": "rgba(0, 0, 0, 0)", + "showlegend": false, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "xaxis": { + "scaleanchor": "y", + "scaleratio": 1, + "title": { + "text": "cell_x" + } + }, + "yaxis": { + "title": { + "text": "cell_y" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig2 = plot_lineage_features(ab_lineage, \"cell_x\", \"cell_y\", \"POSITION_T\")\n", + "# Square the figure\n", + "fig2.update_xaxes(\n", + " scaleanchor=\"y\",\n", + " scaleratio=1,\n", + ")\n", + "\n", + "fig2.show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This plot can be configured a lot, but is very manual.\n", + "\n", + "However, an important capability of pycellin is the ability to reshape and export the data to structure that can be used easily.\n", + "We can export the nodes of the AB lineages as a Pandas dataframe, that can be used very conveniently in ploty-express.\n", + "For instance, the plot above (minus the lines) can be obtained more simply with the following:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "%{hovertext}

cell_x=%{x}
cell_y=%{y}
RADIUS=%{marker.size}
POSITION_T=%{marker.color}", + "hovertext": [ + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.al", + "AB.pl", + "AB.ar", + "AB.pr" + ], + "legendgroup": "", + "marker": { + "color": { + "bdata": "AAAAAAAAAAAAAAAAAAAAQAAAAAAAABBAAAAAAAAAGEAAAAAAAAAgQAAAAAAAACRAAAAAAAAAKEAAAAAAAAAsQAAAAAAAADBAAAAAAAAAMEAAAAAAAAAyQAAAAAAAADJAAAAAAAAANEAAAAAAAAA0QAAAAAAAADZAAAAAAAAANkAAAAAAAAA4QAAAAAAAADhAAAAAAAAAOkAAAAAAAAA6QAAAAAAAADxAAAAAAAAAPEAAAAAAAAA+QAAAAAAAAD5AAAAAAAAAQEAAAAAAAABAQAAAAAAAAEBAAAAAAAAAQEA=", + "dtype": "f8" + }, + "coloraxis": "coloraxis", + "size": { + "bdata": "l9lbdyzCAkC1JM6Zm+8EQORTZPPuNghA5Tgcq6/+C0D2U6igtZgQQOHsdV7SJhFAfFPDvjskDEAPWBKDCB8HQLJJUnfjawFAxAX2rulMAkCev0tzUosFQHu5MUwPzAVAnHDqM+HoB0DwImObxrIJQCf5kPkc/QtAXhft28H7DEBtNK3Xvs4PQA91feSYPxBAqhIkgH60EEDNpEu9D9wQQJaQhfwkhRFADwTCZh4VEUDsoF/uuMwHQOd7vxfeOwdA0+CaGqNyAkCAjr7taLb9P9eAJQ+Mhf0/F0tMMBPE/D8=", + "dtype": "f8" + }, + "sizemode": "area", + "sizeref": 0.010950059761171693, + "symbol": "circle" + }, + "mode": "markers", + "name": "", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": { + "bdata": "8I9m67L8OEBagc9idxo4QP47Epl9kDVAxOXEcjuhNEBabCeroIwzQBnvbeSFyTRA9kBUUSjDNEAM7DWmL/A0QKWuXOEqcTRA5kcBTV2kO0CC6+rDwuwyQL5BH2KqpDxAUmeuXrTxMkCGsTIOGqlAQHu32VYwaTJAfj/1Q9P+QUCOlxOiCi4zQICq99RieEJAz2mL9RThM0Dy0sPxSx5CQKtkwPGFfjRAn5p5ov+UQUBo+/pEDRg1QOO7qR0BP0BAd2UkLgNeM0Df1kkNUWxAQKrAPUScvjVAnA3qVTYVQEA=", + "dtype": "f8" + }, + "xaxis": "x", + "y": { + "bdata": "Fpu62njrPECaTQJAqSY8QF0NPn/ffTpA6HmpBX7wNUBTEPmXMsk0QFU6cg55HTVAwDnbLQPFNEBfUH0QzVU1QFodPzi12jJA3p4Eic4QNkANCR4zjREzQKZGy9a9qzZAsikUtTMGMUA85+5qZl84QCJbdnOjDixA+ULk1+IQOkBh1ZMjLV8oQO5KqIZF7TxABUPgxDbQKkB7CB0eqnU+QOe5JNry5CtASSRCPKhZPUB0yWhRwW8vQE8NLdNm0z5AgX0uN0V9LUDBTX8Dsiw9QEWLsiCdRDBAIoX3K7EWQEA=", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "coloraxis": { + "colorbar": { + "title": { + "text": "POSITION_T" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ] + }, + "legend": { + "itemsizing": "constant", + "tracegroupgap": 0 + }, + "paper_bgcolor": "rgba(0, 0, 0, 0)", + "plot_bgcolor": "rgba(0, 0, 0, 0)", + "showlegend": false, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "AB lineage cells" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "scaleanchor": "y", + "scaleratio": 1, + "title": { + "text": "cell_x" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "cell_y" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Export all the lineages to a pandas dataframe\n", + "df = model.to_cell_dataframe()\n", + "\n", + "# Filter for the AB lineage\n", + "df = df[df['lineage_ID']==ab_lineage_ID]\n", + "\n", + "# Use plotly-express to create a scatter plot.\n", + "# It ships a very convenient syntax to set the color, size, position of a plot based on \n", + "# the values of a dataframe. For instance we can plot the X,Y position of the cells, and color them\n", + "# based on the time of the cell division (POSITION_T). We can also set the size of the points\n", + "# based on the radius of the cells (RADIUS).\n", + "# Note that the dataframe is already filtered for the AB lineage.\n", + "# We can also use the name of the cells as hover name.\n", + "import plotly.express as px\n", + "fig3 = px.scatter(\n", + " df,\n", + " x=\"cell_x\",\n", + " y=\"cell_y\",\n", + " color=\"POSITION_T\",\n", + " size=\"RADIUS\",\n", + " hover_name=\"name\",\n", + " title=\"AB lineage cells\",\n", + " color_continuous_scale=\"jet\",\n", + ")\n", + "\n", + "# Square the figure\n", + "fig3.update_xaxes(\n", + " scaleanchor=\"y\",\n", + " scaleratio=1,\n", + ")\n", + "fig3.update_layout(\n", + " showlegend=False,\n", + " # Transparent background:\n", + " plot_bgcolor='rgba(0, 0, 0, 0)',\n", + " paper_bgcolor='rgba(0, 0, 0, 0)',\n", + " )\n", + "\n", + "\n", + "\n", + "fig3.show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This gives us a good impression on where do the cell move as the development progress. \n", + "But this is just a XY view. \n", + "We can generate an interactive 3D view by using another plotly express function:" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "%{hovertext}

cell_x=%{x}
cell_y=%{y}
cell_z=%{z}
RADIUS=%{marker.size}
POSITION_T=%{marker.color}", + "hovertext": [ + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.a", + "AB.p", + "AB.al", + "AB.pl", + "AB.ar", + "AB.pr" + ], + "legendgroup": "", + "marker": { + "color": { + "bdata": "AAAAAAAAAAAAAAAAAAAAQAAAAAAAABBAAAAAAAAAGEAAAAAAAAAgQAAAAAAAACRAAAAAAAAAKEAAAAAAAAAsQAAAAAAAADBAAAAAAAAAMEAAAAAAAAAyQAAAAAAAADJAAAAAAAAANEAAAAAAAAA0QAAAAAAAADZAAAAAAAAANkAAAAAAAAA4QAAAAAAAADhAAAAAAAAAOkAAAAAAAAA6QAAAAAAAADxAAAAAAAAAPEAAAAAAAAA+QAAAAAAAAD5AAAAAAAAAQEAAAAAAAABAQAAAAAAAAEBAAAAAAAAAQEA=", + "dtype": "f8" + }, + "coloraxis": "coloraxis", + "size": { + "bdata": "l9lbdyzCAkC1JM6Zm+8EQORTZPPuNghA5Tgcq6/+C0D2U6igtZgQQOHsdV7SJhFAfFPDvjskDEAPWBKDCB8HQLJJUnfjawFAxAX2rulMAkCev0tzUosFQHu5MUwPzAVAnHDqM+HoB0DwImObxrIJQCf5kPkc/QtAXhft28H7DEBtNK3Xvs4PQA91feSYPxBAqhIkgH60EEDNpEu9D9wQQJaQhfwkhRFADwTCZh4VEUDsoF/uuMwHQOd7vxfeOwdA0+CaGqNyAkCAjr7taLb9P9eAJQ+Mhf0/F0tMMBPE/D8=", + "dtype": "f8" + }, + "sizemode": "area", + "sizeref": 0.010950059761171693, + "symbol": "circle" + }, + "mode": "markers", + "name": "", + "scene": "scene", + "showlegend": false, + "type": "scatter3d", + "x": { + "bdata": "8I9m67L8OEBagc9idxo4QP47Epl9kDVAxOXEcjuhNEBabCeroIwzQBnvbeSFyTRA9kBUUSjDNEAM7DWmL/A0QKWuXOEqcTRA5kcBTV2kO0CC6+rDwuwyQL5BH2KqpDxAUmeuXrTxMkCGsTIOGqlAQHu32VYwaTJAfj/1Q9P+QUCOlxOiCi4zQICq99RieEJAz2mL9RThM0Dy0sPxSx5CQKtkwPGFfjRAn5p5ov+UQUBo+/pEDRg1QOO7qR0BP0BAd2UkLgNeM0Df1kkNUWxAQKrAPUScvjVAnA3qVTYVQEA=", + "dtype": "f8" + }, + "y": { + "bdata": "Fpu62njrPECaTQJAqSY8QF0NPn/ffTpA6HmpBX7wNUBTEPmXMsk0QFU6cg55HTVAwDnbLQPFNEBfUH0QzVU1QFodPzi12jJA3p4Eic4QNkANCR4zjREzQKZGy9a9qzZAsikUtTMGMUA85+5qZl84QCJbdnOjDixA+ULk1+IQOkBh1ZMjLV8oQO5KqIZF7TxABUPgxDbQKkB7CB0eqnU+QOe5JNry5CtASSRCPKhZPUB0yWhRwW8vQE8NLdNm0z5AgX0uN0V9LUDBTX8Dsiw9QEWLsiCdRDBAIoX3K7EWQEA=", + "dtype": "f8" + }, + "z": { + "bdata": "tBojDG2oMkC9QAeNC/00QMn+Nep+QjRAGUC3SgbQM0Agtmvje/sxQM8yog+oejJAkMEEgs2MMkAAAAAAAAAzQAAAAAAAADFAtBJ7fH0QM0ADnpYCp3kzQM5p4Vbq2TNAkxKecQz6M0A3Tk+M5DE0QAd0mKSoVDRA1dWAzz37M0BQf3ds5CszQOu90ZKz3TNAYPPec0fnM0CsonS87to0QDJpucOyZDNARbX1dpUUNUCogzqog2ozQIhTJqKG/jRAOmkfJAOqMEAAAAAAAAAxQHnnb3FaczdAVI9n14y+N0A=", + "dtype": "f8" + } + } + ], + "layout": { + "coloraxis": { + "colorbar": { + "title": { + "text": "POSITION_T" + } + }, + "colorscale": [ + [ + 0, + "rgb(0,0,131)" + ], + [ + 0.2, + "rgb(0,60,170)" + ], + [ + 0.4, + "rgb(5,255,255)" + ], + [ + 0.6, + "rgb(255,255,0)" + ], + [ + 0.8, + "rgb(250,0,0)" + ], + [ + 1, + "rgb(128,0,0)" + ] + ] + }, + "legend": { + "itemsizing": "constant", + "tracegroupgap": 0 + }, + "paper_bgcolor": "rgba(0, 0, 0, 0)", + "plot_bgcolor": "rgba(0, 0, 0, 0)", + "scene": { + "domain": { + "x": [ + 0, + 1 + ], + "y": [ + 0, + 1 + ] + }, + "xaxis": { + "title": { + "text": "cell_x" + } + }, + "yaxis": { + "title": { + "text": "cell_y" + } + }, + "zaxis": { + "title": { + "text": "cell_z" + } + } + }, + "showlegend": false, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "AB lineage cells" + }, + "xaxis": { + "scaleanchor": "y", + "scaleratio": 1 + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig4 = px.scatter_3d(\n", + " df,\n", + " x=\"cell_x\",\n", + " y=\"cell_y\",\n", + " z=\"cell_z\",\n", + " color=\"POSITION_T\",\n", + " size=\"RADIUS\",\n", + " hover_name=\"name\",\n", + " title=\"AB lineage cells\",\n", + " color_continuous_scale='jet',\n", + ")\n", + "\n", + "# Square the figure\n", + "fig4.update_xaxes(\n", + " scaleanchor=\"y\",\n", + " scaleratio=1,\n", + ")\n", + "fig4.update_layout(\n", + " showlegend=False,\n", + " # Transparent background:\n", + " plot_bgcolor='rgba(0, 0, 0, 0)',\n", + " paper_bgcolor='rgba(0, 0, 0, 0)',\n", + " )\n", + "\n", + "fig4.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This should be adapted to your needs, and will facilitate exploring lineage data.\n", + "In particular, this can be combined with the ability of pycellin to quickly augment a model with new feature definitions.\n" + ] + } + ], + "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.10.16" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/imgs/Celegans-5pc-17timepoints.xml b/notebooks/imgs/Celegans-5pc-17timepoints.xml new file mode 100755 index 0000000..6b19ba7 --- /dev/null +++ b/notebooks/imgs/Celegans-5pc-17timepoints.xml @@ -0,0 +1,717 @@ + + + . + - Track index in 0 ms. + - Track location in 4 ms. + - Track speed in 5 ms. + - Track quality in 4 ms. + - Track motility analysis in 5 ms. +Computation done in 31 ms. +-------------------- +File loaded on Thu, 17 Mar 2022 15:51:20 +TrackMate v7.6.1 +Please note that TrackMate is available through Fiji, and is based on a publication. If you use it successfully for your research please be so kind to cite our work: +Ershov D, Phan M-S, Pylvänäinen JW, Rigaud SU, et al. 'Bringing TrackMate in the era of machine-learning and deep-learning.'bioRxiv. 2021; doi:10.1101/2021.09.03.458852 +https://doi.org/10.1101/2021.09.03.458852 +and / or: +Tinevez, JY.; Perry, N. & Schindelin, J. et al. (2017), 'TrackMate: An open and extensible platform for single-particle tracking.', Methods 115: 80-90, PMID 27713081. +https://www.sciencedirect.com/science/article/pii/S1046202316303346 + +Performing track filtering on the following features: +No feature threshold set, kept the 1345 tracks. + +Configured tracker LAP Tracker with settings: + - max frame gap: 2 + - alternative linking cost factor: 1.05 + - linking feature penalties: + - linking max distance: 1.0 + - gap closing max distance: 15.0 + - merging feature penalties: + - splitting max distance: 15.0 + - blocking value: Infinity + - allow gap closing: false + - allow track splitting: false + - allow track merging: false + - merging max distance: 15.0 + - splitting feature penalties: + - cutoff percentile: 0.9 + - gap closing feature penalties: + + +Performing spot filtering on the following features: +No feature threshold set, kept the 9831 spots. + +Configured detector Thresholding detector with settings: + - target channel: 1 + - simplify contours: true + - intensity threshold: 500.0 + + +Configured detector Thresholding detector with settings: + - target channel: 1 + - simplify contours: true + - intensity threshold: 500.0 + +Starting detection process using 24 threads. +Detection processes 17 frames simultaneously and allocates 1 thread per frame. +Found 82 spots. +Detection done in 0.1 s. + +Computing spot quality histogram... +Initial thresholding with a quality threshold above -1024.4 ... +Starting initial filtering process. +Retained 82 spots out of 82. + +Calculating spot features... +Calculating features done in 0.2 s. + +Performing spot filtering on the following features: +No feature threshold set, kept the 82 spots. + +Configured tracker LAP Tracker with settings: + - max frame gap: 2 + - alternative linking cost factor: 1.05 + - linking feature penalties: + - linking max distance: 1.0 + - gap closing max distance: 15.0 + - merging feature penalties: + - splitting max distance: 15.0 + - blocking value: Infinity + - allow gap closing: false + - allow track splitting: false + - allow track merging: false + - merging max distance: 15.0 + - splitting feature penalties: + - cutoff percentile: 0.9 + - gap closing feature penalties: + +Starting tracking process. +Tracking done in 0.0 s. +Found 5 tracks. + - avg size: 5.0 spots. + - min size: 2 spots. + - max size: 16 spots. + +Configured tracker LAP Tracker with settings: + - max frame gap: 2 + - alternative linking cost factor: 1.05 + - linking feature penalties: + - linking max distance: 15.0 + - gap closing max distance: 15.0 + - merging feature penalties: + - splitting max distance: 15.0 + - blocking value: Infinity + - allow gap closing: false + - allow track splitting: true + - allow track merging: false + - merging max distance: 15.0 + - splitting feature penalties: + - cutoff percentile: 0.9 + - gap closing feature penalties: + +Starting tracking process. +Tracking done in 0.0 s. +Found 4 tracks. + - avg size: 20.0 spots. + - min size: 6 spots. + - max size: 32 spots. + +Calculating features done in 0.0 s. + +Performing track filtering on the following features: +No feature threshold set, kept the 4 tracks. +Saving data... +Computing edge features: + - Directional change in 2 ms. + - Edge speed in 2 ms. + - Edge target in 2 ms. + - Edge location in 1 ms. +Computation done in 8 ms. +Computing track features: + - Cell division rate analyzer in 0 ms. + - Branching analyzer in 1 ms. + - Track duration in 0 ms. + - Track index in 0 ms. + - Track location in 1 ms. + - Track speed in 0 ms. + - Track quality in 0 ms. + - Track motility analysis in 1 ms. +Computation done in 3 ms. +-------------------- +Warnings occured during reading the file: +-------------------- +Unknown track analyzer key: CELL_DIVISION_TIME_ANALYZER. +-------------------- +File loaded on Tue, 1 Apr 2025 14:47:45 +TrackMate v7.14.0 +Please note that TrackMate is available through Fiji, and is based on a publication. If you use it successfully for your research please be so kind to cite our work: +Ershov, D., Phan, MS., Pylvänäinen, J.W., Rigaud S.U., et al. TrackMate 7: integrating state-of-the-art segmentation algorithms into tracking pipelines. Nat Methods (2022). https://doi.org/10.1038/s41592-022-01507-1 +https://doi.org/10.1038/s41592-022-01507-1 +and / or: +Tinevez, JY.; Perry, N. & Schindelin, J. et al. (2017), 'TrackMate: An open and extensible platform for single-particle tracking.', Methods 115: 80-90, PMID 27713081. +https://www.sciencedirect.com/science/article/pii/S1046202316303346 +Some errors occurred while reading file: +Unknown track analyzer key: CELL_DIVISION_TIME_ANALYZER. +Saving data... +Computing edge features: + - Directional change in 11 ms. + - Edge speed in 3 ms. + - Edge target in 6 ms. + - Edge location in 3 ms. +Computation done in 27 ms. +Computing track features: + - Branching analyzer in 10 ms. + - Track duration in 2 ms. + - Track index in 0 ms. + - Track location in 2 ms. + - Track speed in 1 ms. + - Track quality in 2 ms. + - Track motility analysis in 2 ms. +Computation done in 22 ms. + Added log. + Added spot, edge and track feature declarations. + Added 84 spots. + Added tracks. + Added filtered tracks. + Added image information. + Added crop settings. + Added detector settings. + Added initial spot filter. + Added spot feature filters. + Added tracker settings. + Added track feature filters. + Added spot, edge and track analyzers. + Added GUI current state. + Added display settings. + Writing to file. +Data saved to: /Users/tinevez/Development/TrackMateWS/TrackMate/samples/Celegans-5pc-17timepoints.xml +Saving data... +Computing edge features: + - Directional change in 9 ms. + - Edge speed in 1 ms. + - Edge target in 2 ms. + - Edge location in 1 ms. +Computation done in 16 ms. +Computing track features: + - Branching analyzer in 1 ms. + - Track duration in 1 ms. + - Track index in 0 ms. + - Track location in 0 ms. + - Track speed in 2 ms. + - Track quality in 1 ms. + - Track motility analysis in 1 ms. +Computation done in 8 ms. + Added log. + Added spot, edge and track feature declarations. + Added 84 spots. + Added tracks. + Added filtered tracks. + Added image information. + Added crop settings. + Added detector settings. + Added initial spot filter. + Added spot feature filters. + Added tracker settings. + Added track feature filters. + Added spot, edge and track analyzers. + Added GUI current state. + Added display settings. + Writing to file. +Data saved to: /Users/tinevez/Development/TrackMateWS/TrackMate/samples/Celegans-5pc-17timepoints.xml +Saving data... +Computing edge features: + - Directional change in 39 ms. + - Edge speed in 16 ms. + - Edge target in 8 ms. + - Edge location in 17 ms. +Computation done in 81 ms. +Computing track features: + - Branching analyzer in 2 ms. + - Track duration in 0 ms. + - Track index in 0 ms. + - Track location in 0 ms. + - Track speed in 1 ms. + - Track quality in 1 ms. + - Track motility analysis in 2 ms. +Computation done in 9 ms. + Added log. + Added spot, edge and track feature declarations. + Added 84 spots. + Added tracks. + Added filtered tracks. + Added image information. + Added crop settings. + Added detector settings. + Added initial spot filter. + Added spot feature filters. + Added tracker settings. + Added track feature filters. + Added spot, edge and track analyzers. + Added GUI current state. + Added display settings. + Writing to file. +Data saved to: /Users/tinevez/Development/TrackMateWS/TrackMate/samples/Celegans-5pc-17timepoints.xml +Saving data... +Computing edge features: + - Directional change in 12 ms. + - Edge speed in 1 ms. + - Edge target in 2 ms. + - Edge location in 1 ms. +Computation done in 20 ms. +Computing track features: + - Branching analyzer in 2 ms. + - Track duration in 1 ms. + - Track index in 0 ms. + - Track location in 0 ms. + - Track speed in 2 ms. + - Track quality in 2 ms. + - Track motility analysis in 1 ms. +Computation done in 11 ms. + Added log. + Added spot, edge and track feature declarations. + Added 86 spots. + Added tracks. + Added filtered tracks. + Added image information. + Added crop settings. + Added detector settings. + Added initial spot filter. + Added spot feature filters. + Added tracker settings. + Added track feature filters. + Added spot, edge and track analyzers. + Added GUI current state. + Added display settings. + Writing to file. +Data saved to: /Users/tinevez/Development/TrackMateWS/TrackMate/samples/Celegans-5pc-17timepoints.xml +Saving data... +Computing edge features: + - Directional change in 15 ms. + - Edge speed in 3 ms. + - Edge target in 1 ms. + - Edge location in 3 ms. +Computation done in 24 ms. +Computing track features: + - Branching analyzer in 3 ms. + - Track duration in 1 ms. + - Track index in 0 ms. + - Track location in 1 ms. + - Track speed in 0 ms. + - Track quality in 2 ms. + - Track motility analysis in 1 ms. +Computation done in 10 ms. + Added log. + Added spot, edge and track feature declarations. + Added 87 spots. + Added tracks. + Added filtered tracks. + Added image information. + Added crop settings. + Added detector settings. + Added initial spot filter. + Added spot feature filters. + Added tracker settings. + Added track feature filters. + Added spot, edge and track analyzers. + Added GUI current state. + Added display settings. + Writing to file. +Data saved to: /Users/tinevez/Development/TrackMateWS/TrackMate/samples/Celegans-5pc-17timepoints.xml +Saving data... +Computing edge features: + - Directional change in 15 ms. + - Edge speed in 3 ms. + - Edge target in 9 ms. + - Edge location in 4 ms. +Computation done in 35 ms. +Computing track features: + - Branching analyzer in 4 ms. + - Track duration in 1 ms. + - Track index in 0 ms. + - Track location in 1 ms. + - Track speed in 0 ms. + - Track quality in 3 ms. + - Track motility analysis in 1 ms. +Computation done in 12 ms. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "name": "CurrentDisplaySettings", + "spotUniformColor": "204, 51, 204, 255", + "spotColorByType": "TRACKS", + "spotColorByFeature": "TRACK_INDEX", + "spotDisplayRadius": 1.0, + "spotDisplayedAsRoi": true, + "spotMin": 0.0, + "spotMax": 10.0, + "spotShowName": true, + "trackMin": 0.0, + "trackMax": 10.0, + "trackColorByType": "TRACKS", + "trackColorByFeature": "TRACK_INDEX", + "trackUniformColor": "204, 204, 51, 255", + "undefinedValueColor": "0, 0, 0, 255", + "missingValueColor": "89, 89, 89, 255", + "highlightColor": "51, 230, 51, 255", + "trackDisplayMode": "FULL", + "colormap": "Jet", + "limitZDrawingDepth": false, + "drawingZDepth": 10.0, + "fadeTracks": true, + "fadeTrackRange": 30, + "useAntialiasing": true, + "spotVisible": true, + "trackVisible": true, + "font": { + "name": "Arial", + "style": 1, + "size": 12, + "pointSize": 12.0, + "fontSerializedDataVersion": 1 + }, + "lineThickness": 2.0, + "selectionLineThickness": 4.0, + "trackschemeBackgroundColor1": "128, 128, 128, 255", + "trackschemeBackgroundColor2": "192, 192, 192, 255", + "trackschemeForegroundColor": "0, 0, 0, 255", + "trackschemeDecorationColor": "0, 0, 0, 255", + "trackschemeFillBox": false, + "spotFilled": false, + "spotTransparencyAlpha": 1.0 +} + diff --git a/notebooks/imgs/movie.mp4 b/notebooks/imgs/movie.mp4 new file mode 100644 index 0000000..44439cf Binary files /dev/null and b/notebooks/imgs/movie.mp4 differ