|
| 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.6 |
| 24 | + plotly: |
| 25 | + # description: |
| 26 | + display_as: bio |
| 27 | + language: python |
| 28 | + layout: base |
| 29 | + name: Alignment Chart |
| 30 | + order: 1 |
| 31 | + page_type: u-guide |
| 32 | + permalink: python/alignment-chart/ |
| 33 | + thumbnail: thumbnail/alignment-chart.png |
| 34 | +--- |
| 35 | + |
| 36 | +## Default AlignmentChart |
| 37 | +An example of a default AlignmentChart component without any extra properties |
| 38 | + |
| 39 | +```python |
| 40 | +import urllib.request as urlreq |
| 41 | + |
| 42 | +from jupyter_dash import JupyterDash |
| 43 | +import dash_bio as dashbio |
| 44 | + |
| 45 | +app = JupyterDash(__name__) |
| 46 | + |
| 47 | +data = urlreq.urlopen( |
| 48 | + 'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/' + |
| 49 | + 'alignment_viewer_p53.fasta' |
| 50 | +).read().decode('utf-8') |
| 51 | + |
| 52 | +app.layout = dashbio.AlignmentChart( |
| 53 | + id='my-default-alignment-viewer', |
| 54 | + data=data |
| 55 | +) |
| 56 | + |
| 57 | +app.run_server(mode="inline") |
| 58 | +``` |
| 59 | + |
| 60 | +## Consensus Sequence |
| 61 | +Toggle the display of the consensus sequence at the bottom of the heatmap. |
| 62 | + |
| 63 | +```python |
| 64 | +import urllib.request as urlreq |
| 65 | + |
| 66 | +import dash_bio as dashbio |
| 67 | +from jupyter_dash import JupyterDash |
| 68 | + |
| 69 | +app = JupyterDash(__name__) |
| 70 | + |
| 71 | +data = urlreq.urlopen('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/alignment_viewer_p53.fasta').read().decode('utf-8') |
| 72 | + |
| 73 | +app.layout = dashbio.AlignmentChart( |
| 74 | + data=data, |
| 75 | + showconsensus=False |
| 76 | +) |
| 77 | + |
| 78 | +app.run_server(mode="inline") |
| 79 | +``` |
| 80 | + |
| 81 | +## Tile Size |
| 82 | +Change the height and/or width of the tiles. |
| 83 | + |
| 84 | + |
| 85 | +```python |
| 86 | +import urllib.request as urlreq |
| 87 | +import dash_bio as dashbio |
| 88 | + |
| 89 | +data = urlreq.urlopen('https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/alignment_viewer_p53.fasta').read().decode('utf-8') |
| 90 | + |
| 91 | +app.layout = dashbio.AlignmentChart( |
| 92 | + data=data, |
| 93 | + tilewidth=50 |
| 94 | +) |
| 95 | + |
| 96 | +app.run_server(mode="inline") |
| 97 | +``` |
| 98 | + |
| 99 | +## AlignmentChart Properties |
| 100 | +> Access this documentation in your Python terminal with: |
| 101 | +> |
| 102 | +> ```>>> help(dash_bio.AlignmentChart)``` |
| 103 | +> |
| 104 | +> Our recommended IDE for writing Dash apps is Dash Enterprise's Data Science Workspaces, which has typeahead support for Dash Component Properties. Find out if your company is using Dash Enterprise. |
| 105 | +
|
| 106 | +**id** (_string_; optional): The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app. |
| 107 | + |
| 108 | +**colorscale** (_string_ | _dict_; default `'clustal2'`): Colorscale in 'buried', 'cinema', 'clustal', 'clustal2', 'helix', 'hydrophobicity' 'lesk', 'mae', 'nucleotide', 'purine', 'strand', 'taylor', 'turn', 'zappo', or your own colorscale as a {'nucleotide': COLOR} dict. Note that this is NOT a standard plotly colorscale. |
| 109 | + |
| 110 | +**conservationcolor** (_string_; optional): Color of the conservation secondary barplot, in common name, hex, rgb or rgba format. |
| 111 | + |
| 112 | +**conservationcolorscale** (_string_ | _list_; default `'Viridis'`): Colorscale of the conservation barplot, in Plotly colorscales (e.g. 'Viridis') or as custom Plotly colorscale under a list format. Note that this conservationcolorscale argument does NOT follow the same format as the colorscale argument. |
| 113 | + |
| 114 | +**conservationmethod** (_a value equal to: 'conservation', 'entropy'_; default `'entropy'`): Whether to use most conserved ratio (MLE) 'conservation' or normalized entropy 'entropy' to determine conservation, which is a value between 0 and 1 where 1 is most conserved. |
| 115 | + |
| 116 | +**conservationopacity** (_number_ | _string_; optional): Opacity of the conservation secondary barplot as a value between 0 and 1. |
| 117 | + |
| 118 | +**correctgap** (_boolean_; default `True`): Whether to normalize the conservation barchart By multiplying it elementwise with the gap barchart, as to lower the conservation values across sequences regions with many gaps. |
| 119 | + |
| 120 | +**data** (_string_; optional): Input data, either in FASTA or Clustal format. |
| 121 | + |
| 122 | +**eventDatum** (_string_; optional): A Dash prop that returns data on clicking, hovering or resizing the viewer. |
| 123 | + |
| 124 | +**extension** (_string_; default `'fasta'`): Format type of the input data, either in FASTA or Clustal. |
| 125 | + |
| 126 | +**gapcolor** (_string_; default `'grey'`): Color of the gap secondary barplot, in common name, hex, rgb or rgba format. |
| 127 | + |
| 128 | +**gapcolorscale** (_string_ | _list_; optional): Colorscale of the gap barplot, in Plotly colorscales (e.g. 'Viridis') or as custom Plotly colorscale under a list format. Note that this conservationcolorscale argument does NOT follow the same format as the colorscale argument. |
| 129 | + |
| 130 | +**gapopacity** (_number_ | _string_; optional): Opacity of the gap secondary barplot as a value between 0 and 1. |
| 131 | + |
| 132 | +**groupbars** (_boolean_; default `False`): If both conservation and gap are enabled, toggles whether to group bars or to stack them as separate subplots. No effect if not both gap and conservation are shown. |
| 133 | + |
| 134 | +**height** (_number_ | _string_; default `900`): Width of the Viewer. Property takes precedence over tilesheight if both are set. |
| 135 | + |
| 136 | +**numtiles** (_number_; optional): Sets how many tiles to display across horitontally. If enabled, overrides tilewidth and sets the amount of tiles directly based off that value. |
| 137 | + |
| 138 | +**opacity** (_number_ | _string_; optional): Opacity of the main plot as a value between 0 and 1. |
| 139 | + |
| 140 | +**overview** (_a value equal to: 'heatmap', 'slider', 'none'_; default `heatmap`): Toggles whether the overview should be a heatmap, a slider, or none. |
| 141 | + |
| 142 | +**scrollskip** (_number_; default `10`): If overview is set to 'scroll', determines how many tiles to skip with each slider movement. Has no effect if scroll is not enabled (such as with overview or none). |
| 143 | + |
| 144 | +**showconsensus** (_boolean_; default `True`): Displays toggling the consensus sequence, where each nucleotide in the consensus sequence is the argmax of its distribution at a set nucleotide. |
| 145 | + |
| 146 | +**showconservation** (_boolean_; default `True`): Enables the display of conservation secondary barplot where the most conserved nucleotides or amino acids get greater bars. |
| 147 | + |
| 148 | +**showgap** (_boolean_; default `True`): Enables the display of gap secondary barplot where the sequence regions with the fewest gaps get the greatest bars. |
| 149 | + |
| 150 | +**showid** (_boolean_; default `True`): Toggles displaying sequence IDs at left of alignment. |
| 151 | + |
| 152 | +**showlabel** (_boolean_; default `True`): Toggles displaying sequence labels at left of alignment. |
| 153 | + |
| 154 | +**textcolor** (_string_; optional): Color of the nucleotide labels, in common name, hex, rgb or rgba format. If left blank, handled by the colorscale automatically. |
| 155 | + |
| 156 | +**textsize** (_number_ | _string_; default `10`): Size of the nucleotide labels, as a number. |
| 157 | + |
| 158 | +**tickstart** (_number_ | _string_; optional): Determines where to start annotating the first tile. If let blank will be automatically determined by Plotly. Equivalent to Plotly's tick0 property. Does not function if overview mode 'slider' is applied. (Current bug). |
| 159 | + |
| 160 | +**ticksteps** (_number_ | _string_; optional): Determines at what interval to keep annotating the tiles. If left blank will be automatially determined by Plotly. Equivalent to Plotly's dtick property. Does not function if overview mode 'slider' is applied. (Current bug). |
| 161 | + |
| 162 | +**tileheight** (_number_; default `16`): Sets how many pixels each nucleotide/amino acid on the Alignment Chart takes up vertically. If enabled, set height dynamically. |
| 163 | + |
| 164 | +**tilewidth** (_number_; default `16`): Sets how many pixels each nucleotide/amino acid on the Alignment Chart takes up horizontally. The total number of tiles (numtiles) seen horizontally is automatically determined by rounding the Viewer width divided by the tile width. the Viewwer width divided by the tile witdth. |
| 165 | + |
| 166 | +**width** (_number_ | _string_; optional): Width of the Viewer. Property takes precedence over tileswidth and numtiles if either of them is set. |
| 167 | + |
| 168 | +```python |
| 169 | + |
| 170 | +``` |
0 commit comments