Skip to content

Commit 41cb53c

Browse files
committed
docs:bio: bar chart for conversion viz + alignment chart iframe url
1 parent 44b3c5f commit 41cb53c

File tree

1 file changed

+10
-49
lines changed

1 file changed

+10
-49
lines changed

doc/python/bio-alignment-chart.md

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -32,63 +32,24 @@ jupyter:
3232
thumbnail: thumbnail/alignment-chart.png
3333
---
3434

35-
## Default AlignmentChart
36-
An example of a default AlignmentChart component without any extra properties
35+
## Bar Chart for conservation visualization
3736

3837
```python
39-
import urllib.request as urlreq
38+
import plotly.express as px
4039

41-
import dash_bio as dashbio
40+
df = (pd.read_csv('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/gene_conservation.csv')
41+
.set_index('0')
42+
.loc[['consensus','conservation']]
43+
.T)
4244

43-
44-
data = urlreq.urlopen(
45-
'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/' +
46-
'alignment_viewer_p53.fasta'
47-
).read().decode('utf-8')
48-
49-
app.layout = dashbio.AlignmentChart(
50-
id='my-default-alignment-viewer',
51-
data=data
52-
)
53-
```
54-
55-
## Consensus Sequence
56-
Toggle the display of the consensus sequence at the bottom of the heatmap.
57-
58-
```python
59-
import urllib.request as urlreq
60-
61-
import dash_bio as dashbio
62-
63-
64-
data = urlreq.urlopen('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/alignment_viewer_p53.fasta').read().decode('utf-8')
65-
66-
app.layout = dashbio.AlignmentChart(
67-
data=data,
68-
showconsensus=False
69-
)
70-
```
71-
72-
## Tile Size
73-
Change the height and/or width of the tiles.
74-
75-
76-
```python
77-
import urllib.request as urlreq
78-
import dash_bio as dashbio
79-
80-
data = urlreq.urlopen('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/alignment_viewer_p53.fasta').read().decode('utf-8')
81-
82-
app.layout = dashbio.AlignmentChart(
83-
data=data,
84-
tilewidth=50
85-
)
45+
fig = px.bar(df, labels={ 'index': 'base' }, hover_name='consensus', y='conservation')
46+
fig.show()
8647
```
8748

88-
## Alignment Chart in `dash_bio`
49+
## Alignment Chart in dash_bio
8950

9051
```python
9152
from IPython.display import IFrame
9253
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
93-
IFrame(snippet_url + 'bio-circos', width='100%', height=630)
54+
IFrame(snippet_url + 'bio-alignmentchart', width='100%', height=630)
9455
```

0 commit comments

Comments
 (0)