Skip to content

Commit 2c47686

Browse files
Merge branch 'doc-prod'
2 parents 13fe3b2 + 77922d3 commit 2c47686

7 files changed

+354
-2
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [next] - ???
66

7+
### Added
8+
- dash-bio posts in /doc/python/{alignment-chart.md,circos.md,clustergram.md,molecular-visualizations.md,volacano-plot.md}
9+
710
### Fixed
811
- Fixed error when serializing dict with mix of string and non-string keys [#3380](https://github.com/plotly/plotly.py/issues/3380)
912

Diff for: doc/python/bio-alignment-chart.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: '1.3'
9+
jupytext_version: 1.13.0
10+
kernelspec:
11+
display_name: Python 3 (ipykernel)
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.9.7
24+
plotly:
25+
display_as: bio
26+
language: python
27+
layout: base
28+
name: Alignment Chart
29+
order: 1
30+
page_type: u-guide
31+
permalink: python/alignment-chart/
32+
thumbnail: thumbnail/alignment-chart.png
33+
---
34+
35+
## Alignment Viewer (link to dash alignment section below)
36+
37+
The Alignment Viewer (MSA) component is used to align multiple genomic or proteomic sequences from a FASTA or Clustal file. Among its extensive set of features, the multiple sequence alignment viewer can display multiple subplots showing gap and conservation info, alongside industry standard colorscale support and consensus sequence. No matter what size your alignment is, Alignment Viewer is able to display your genes or proteins snappily thanks to the underlying WebGL architecture powering the component. You can quickly scroll through your long sequence with a slider or a heatmap overview.
38+
39+
Note that the AlignmentChart only returns a chart of the sequence, while AlignmentViewer has integrated controls for colorscale, heatmaps, and subplots allowing you to interactively control your sequences.
40+
41+
## Bar Chart for conservation visualization
42+
43+
```python
44+
import plotly.express as px
45+
import pandas as pd
46+
47+
df = (pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Genetic/gene_conservation.csv')
48+
.set_index('0')
49+
.loc[['consensus','conservation']]
50+
.T)
51+
52+
fig = px.bar(df, labels={ 'index': 'base' }, hover_name='consensus', y='conservation')
53+
fig.show()
54+
```
55+
56+
## Alignment Chart in dash_bio
57+
58+
```python no_display=true
59+
from IPython.display import IFrame
60+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
61+
IFrame(snippet_url + 'bio-alignmentchart', width='100%', height=630)
62+
```

Diff for: doc/python/bio-clustergram.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: '1.3'
9+
jupytext_version: 1.13.0
10+
kernelspec:
11+
display_name: Python 3 (ipykernel)
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.9.7
24+
plotly:
25+
display_as: bio
26+
language: python
27+
layout: base
28+
name: Clustergram
29+
order: 1
30+
page_type: u-guide
31+
permalink: python/clustergram/
32+
thumbnail: thumbnail/clustergram.png
33+
---
34+
35+
## Default Clustergram
36+
A clustergram is a combination heatmap-dendrogram that is commonly used in gene expression data. The hierarchical clustering that is represented by the dendrograms can be used to identify groups of genes with related expression levels. The Dash Bio Clustergram component is a Python-based component that uses plotly.py to generate a figure. It takes as input a two-dimensional numpy array of floating-point values. Imputation of missing data and computation of hierarchical clustering both occur within the component itself. Clusters that meet or exceed a user-defined threshold of similarity comprise single traces in the corresponding dendrogram, and can be highlighted with annotations. The user can specify additional parameters to customize the metrics and methods used to compute parts of the clustering, such as the pairwise distance between observations and the linkage matrix.
37+
38+
```python
39+
import pandas as pd
40+
import dash_bio
41+
42+
43+
df = pd.read_csv(
44+
'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' +
45+
'clustergram_brain_cancer.csv',
46+
)
47+
48+
dash_bio.Clustergram(
49+
data=df,
50+
column_labels=list(df.columns.values),
51+
row_labels=list(df.index),
52+
height=800,
53+
width=700
54+
)
55+
```
56+
57+
## Dendrogram Cluster Colors/Line Widths
58+
Change the colors of the dendrogram traces that are used to represent clusters, and configure their line widths.
59+
60+
61+
```python
62+
import pandas as pd
63+
import dash_bio
64+
65+
df = pd.read_csv(
66+
'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' +
67+
'clustergram_brain_cancer.csv',
68+
)
69+
70+
dash_bio.Clustergram(
71+
data=df,
72+
column_labels=list(df.columns.values),
73+
row_labels=list(df.index),
74+
height=800,
75+
width=700,
76+
color_list={
77+
'row': ['#636EFA', '#00CC96', '#19D3F3'],
78+
'col': ['#AB63FA', '#EF553B'],
79+
'bg': '#506784'
80+
},
81+
line_width=2
82+
)
83+
```
84+
85+
## Relative Dendrogram Size
86+
Change the relative width and height of, respectively, the row and column dendrograms compared to the width and height of the heatmap.
87+
88+
89+
```python
90+
import pandas as pd
91+
import dash_bio
92+
93+
df = pd.read_csv(
94+
'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' +
95+
'clustergram_brain_cancer.csv',
96+
)
97+
98+
dash_bio.Clustergram(
99+
data=df,
100+
column_labels=list(df.columns.values),
101+
row_labels=list(df.index),
102+
height=800,
103+
width=700,
104+
display_ratio=[0.1, 0.7]
105+
)
106+
```
107+
108+
## Clustergram with Dash
109+
110+
```python no_display=true
111+
from IPython.display import IFrame
112+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
113+
IFrame(snippet_url + 'bio-clustergram', width='100%', height=630)
114+
```

Diff for: doc/python/bio-manhattanplot.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
jupyter:
3+
celltoolbar: Tags
4+
jupytext:
5+
notebook_metadata_filter: all
6+
text_representation:
7+
extension: .md
8+
format_name: markdown
9+
format_version: '1.3'
10+
jupytext_version: 1.13.0
11+
kernelspec:
12+
display_name: Python 3 (ipykernel)
13+
language: python
14+
name: python3
15+
language_info:
16+
codemirror_mode:
17+
name: ipython
18+
version: 3
19+
file_extension: .py
20+
mimetype: text/x-python
21+
name: python
22+
nbconvert_exporter: python
23+
pygments_lexer: ipython3
24+
version: 3.9.7
25+
plotly:
26+
display_as: bio
27+
language: python
28+
layout: base
29+
name: Manhattan Plot
30+
order: 1
31+
page_type: u-guide
32+
permalink: python/manhattan-plot/
33+
thumbnail: thumbnail/manhttan-plot.png
34+
---
35+
36+
## Manhattan Plot
37+
ManhattanPlot allows you to visualize genome-wide association studies (GWAS) efficiently. Using WebGL under the hood, you can interactively explore overviews of massive datasets comprising hundreds of thousands of points at once, or take a closer look at a small subset of your data. Hover data and click data are accessible from within the Dash app.
38+
39+
```python
40+
import pandas as pd
41+
import dash_bio as dashbio
42+
43+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/manhattan_data.csv')
44+
45+
46+
dashbio.ManhattanPlot(
47+
dataframe=df,
48+
)
49+
```
50+
51+
## Highlighted points color, and colors of the suggestive line and the genome-wide line.
52+
Change the color of the points that are considered significant.
53+
54+
```python
55+
import pandas as pd
56+
import dash_bio as dashbio
57+
58+
59+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/manhattan_data.csv')
60+
61+
dashbio.ManhattanPlot(
62+
dataframe=df,
63+
highlight_color='#00FFAA',
64+
suggestiveline_color='#AA00AA',
65+
genomewideline_color='#AA5500'
66+
)
67+
```
68+
69+
## ManhattanPlot with Dash
70+
71+
```python no_display=true
72+
from IPython.display import IFrame
73+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
74+
IFrame(snippet_url + 'bio-manhattanplot', width='100%', height=630)
75+
```

Diff for: doc/python/bio-volcano-plot.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
jupyter:
3+
celltoolbar: Tags
4+
jupytext:
5+
notebook_metadata_filter: all
6+
text_representation:
7+
extension: .md
8+
format_name: markdown
9+
format_version: '1.3'
10+
jupytext_version: 1.13.0
11+
kernelspec:
12+
display_name: Python 3 (ipykernel)
13+
language: python
14+
name: python3
15+
language_info:
16+
codemirror_mode:
17+
name: ipython
18+
version: 3
19+
file_extension: .py
20+
mimetype: text/x-python
21+
name: python
22+
nbconvert_exporter: python
23+
pygments_lexer: ipython3
24+
version: 3.9.7
25+
plotly:
26+
display_as: bio
27+
language: python
28+
layout: base
29+
name: Volcano Plot
30+
order: 1
31+
page_type: u-guide
32+
permalink: python/volcano-plot/
33+
thumbnail: thumbnail/volcano-plot.png
34+
---
35+
36+
## VolcanoPlot
37+
Volcano Plot interactively identifies clinically meaningful markers in genomic experiments, i.e., markers that are statistically significant and have an effect size greater than some threshold. Specifically, volcano plots depict the negative log-base-10 p-values plotted against their effect size.
38+
39+
```python
40+
import pandas as pd
41+
import dash_bio
42+
43+
44+
df = pd.read_csv(
45+
'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/' +
46+
'volcano_data1.csv'
47+
)
48+
49+
dash_bio.VolcanoPlot(
50+
dataframe=df,
51+
)
52+
```
53+
54+
## Point Sizes And Line Widths
55+
Change the size of the points on the scatter plot, and the widths of the effect lines and genome-wide line.
56+
57+
58+
```python
59+
import pandas as pd
60+
import dash_bio as dashbio
61+
62+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/volcano_data1.csv')
63+
64+
dashbio.VolcanoPlot(
65+
dataframe=df,
66+
point_size=10,
67+
effect_size_line_width=4,
68+
genomewideline_width=2
69+
)
70+
```
71+
72+
## VolcanoPlot with Dash
73+
74+
```python no_display=true
75+
from IPython.display import IFrame
76+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
77+
IFrame(snippet_url + 'bio-volcano', width='100%', height=630)
78+
```

Diff for: doc/python/getting-started.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ or `conda`:
6666
```
6767
$ conda install -c plotly plotly=5.3.1
6868
```
69-
7069
This package contains everything you need to write figures to standalone HTML files.
7170

71+
You'll also likely want `dash` for adding widgets such as sliders, buttons, and dropdowns to your charts (see more below):
72+
73+
```
74+
$ pip install dash
75+
```
76+
7277
> Note: **No internet connection, account, or payment is required to use plotly.py.** Prior to version 4, this library could operate in either an "online" or "offline" mode. The documentation tended to emphasize the online mode, where graphs get published to the Chart Studio web service. In version 4, all "online" functionality was removed from the `plotly` package and is now available as the separate, optional, `chart-studio` package (See below). **plotly.py version 4 is "offline" only, and does not include any functionality for uploading figures or data to cloud services.**
7378
7479

@@ -78,7 +83,7 @@ fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
7883
fig.write_html('first_figure.html', auto_open=True)
7984
```
8085

81-
### Plotly chart in Dash
86+
### Plotly charts in Dash
8287

8388
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
8489

@@ -106,6 +111,20 @@ or `conda`:
106111
$ conda install "jupyterlab>=3" "ipywidgets>=7.6"
107112
```
108113

114+
You'll ned `jupyter-dash` to add widgets such as sliders, dropdowns, and buttons to Plotly charts in JupyterLab.
115+
116+
Install [`jupyter-dash`](https://github.com/plotly/jupyter-dash) using `pip`:
117+
118+
```
119+
$ pip install jupyter-dash
120+
```
121+
122+
or `conda`:
123+
124+
```
125+
$ conda install -c conda-forge -c plotly jupyter-dash
126+
```
127+
109128
These packages contain everything you need to run JupyterLab...
110129

111130
```

Diff for: doc/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ pooch
3333
wget
3434
nbconvert==5.6.1
3535
orjson
36+
dash-bio

0 commit comments

Comments
 (0)