-
Notifications
You must be signed in to change notification settings - Fork 42
Added LOGO track #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pmustonebi
wants to merge
2
commits into
ebi-webcomponents:main
Choose a base branch
from
pmustonebi:add-logo-track
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Added LOGO track #328
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| # nightingale-logo-track | ||
|
|
||
| [](https://www.npmjs.com/package/@nightingale-elements/nightingale-logo-track) | ||
|
|
||
| The `nightingale-logo-track` component renders a sequence logo from a multiple sequence alignment. It works with both nucleotide (RNA/DNA) and amino acid (protein) alignments — the sequence type is detected automatically from the data. Each column displays letters scaled by their information content (IC), computed as the reduction in Shannon entropy relative to the maximum possible entropy for the alphabet. Gap-heavy columns are scaled down proportionally by coverage. The most-conserved residue is rendered at the top of each stack. | ||
|
|
||
| **Nucleotide colour scheme (RNA/DNA — up to 2 bits per column)** | ||
|
|
||
| | Base | Colour | | ||
| |------|--------| | ||
| | A | Green `#00CC00` | | ||
| | C | Blue `#0000CC` | | ||
| | G | Amber `#FFB300` | | ||
| | U / T | Red `#CC0000` | | ||
|
|
||
| DNA thymine (T) is automatically treated as RNA uracil (U). | ||
|
|
||
| **Amino acid colour scheme (protein — up to ~4.32 bits per column)** | ||
|
|
||
| Colors follow the [WebLogo](https://weblogo.threeplusone.com) chemistry grouping: | ||
|
|
||
| | Group | Residues | Colour | | ||
| |-------|----------|--------| | ||
| | Hydrophobic | A G V L I P F M W | Orange `#FF8C00` | | ||
| | Polar uncharged | S T C Y N Q | Green `#00CC00` | | ||
| | Positively charged | K R H | Blue `#0000CC` | | ||
| | Negatively charged | D E | Red `#CC0000` | | ||
|
|
||
| As `nightingale-logo-track` implements `withManager`, `withZoom`, and `withSVGHighlight`, it will respond to zoom, pan, and highlight events propagated by `nightingale-manager` and emit change events when the user interacts with it. | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Standalone | ||
|
|
||
| ```html | ||
| <nightingale-logo-track | ||
| id="logo" | ||
| height="120" | ||
| min-width="400" | ||
| length="23" | ||
| margin-top="10" | ||
| margin-bottom="10" | ||
| use-ctrl-to-zoom | ||
| ></nightingale-logo-track> | ||
|
|
||
| <script type="module"> | ||
| import "@nightingale-elements/nightingale-logo-track"; | ||
| const track = document.querySelector("#logo"); | ||
| track.sequences = [ | ||
| { name: "seq1", sequence: "AAAGUCGGGCUUAUGCAACCGGU" }, | ||
| { name: "seq2", sequence: "AAACCCGGGCUUAUGCAACCGGU" }, | ||
| // ... | ||
| ]; | ||
| </script> | ||
| ``` | ||
|
|
||
| ### With `nightingale-manager` | ||
|
|
||
| Placing the track inside a `nightingale-manager` synchronises zoom, pan, and highlight with any other registered nightingale components (navigation, MSA, sequence, etc.). | ||
|
|
||
| ```html | ||
| <nightingale-manager> | ||
| <nightingale-navigation | ||
| id="nav" | ||
| height="44" | ||
| length="23" | ||
| ></nightingale-navigation> | ||
|
|
||
| <nightingale-logo-track | ||
| id="logo" | ||
| height="120" | ||
| length="23" | ||
| margin-top="10" | ||
| margin-bottom="10" | ||
| highlight-event="onmouseover" | ||
| highlight-color="#EB3BFF22" | ||
| use-ctrl-to-zoom | ||
| ></nightingale-logo-track> | ||
| </nightingale-manager> | ||
|
|
||
| <script type="module"> | ||
| import "@nightingale-elements/nightingale-manager"; | ||
| import "@nightingale-elements/nightingale-navigation"; | ||
| import "@nightingale-elements/nightingale-logo-track"; | ||
|
|
||
| await customElements.whenDefined("nightingale-logo-track"); | ||
| document.querySelector("#logo").sequences = [ | ||
| { name: "seq1", sequence: "AAAGUCGGGCUUAUGCAACCGGU" }, | ||
| { name: "seq2", sequence: "AAACCCGGGCUUAUGCAACCGGU" }, | ||
| // ... | ||
| ]; | ||
| </script> | ||
| ``` | ||
|
|
||
| ## API Reference | ||
|
|
||
| ### Properties | ||
|
|
||
| #### `sequences: Array<{ name: string; sequence: string }>` | ||
|
|
||
| Gets or sets the multiple sequence alignment data. Each entry is an object with a `name` string and a `sequence` string containing single-letter residue codes. Gap characters (`-`, `.`) and unrecognised characters are ignored when computing information content. | ||
|
|
||
| The sequence type is detected automatically when `sequences` is set: if more than 5 % of non-gap characters are amino-acid-specific letters (anything outside `A C G T U N`), the track switches to protein mode and applies the amino acid colour scheme and a 20-letter IC ceiling. Otherwise it operates in nucleotide mode and DNA thymine is treated as uracil. | ||
|
|
||
| ```javascript | ||
| // RNA / DNA | ||
| track.sequences = [ | ||
| { name: "seq1", sequence: "AAAGUCGGGCUUAUGCAACCGGU" }, | ||
| { name: "seq2", sequence: "AAACCCGAGCUUAUGCAACCGGU" }, | ||
| ]; | ||
|
|
||
| // Protein — type detected automatically | ||
| track.sequences = [ | ||
| { name: "prot1", sequence: "AMSMSVLKHHFDA" }, | ||
| { name: "prot2", sequence: "AMSMSVLRHHFDA" }, | ||
| ]; | ||
| ``` | ||
|
|
||
| ### Attributes | ||
|
|
||
| All standard nightingale attributes are supported. | ||
|
|
||
| #### `height?: number` | ||
|
|
||
| Height of the track in pixels. Defaults to the element's CSS height. | ||
|
|
||
| #### `length?: number` | ||
|
|
||
| Total length of the aligned sequences (number of columns). | ||
|
|
||
| #### `display-start?: number (default: 1)` | ||
|
|
||
| First sequence position to display. Managed automatically by `nightingale-manager`. | ||
|
|
||
| #### `display-end?: number` | ||
|
|
||
| Last sequence position to display. Managed automatically by `nightingale-manager`. | ||
|
|
||
| #### `margin-top?: number (default: 0)` | ||
|
|
||
| Top margin in pixels. | ||
|
|
||
| #### `margin-bottom?: number (default: 0)` | ||
|
|
||
| Bottom margin in pixels. | ||
|
|
||
| #### `margin-left?: number (default: 10)` | ||
|
|
||
| Left margin in pixels. | ||
|
|
||
| #### `margin-right?: number (default: 10)` | ||
|
|
||
| Right margin in pixels. | ||
|
|
||
| #### `margin-color?: string (default: "#ffffffdd")` | ||
|
|
||
| Fill colour for the margin overlay rectangles. | ||
|
|
||
| #### `highlight-event?: "onmouseover" | "onclick"` | ||
|
|
||
| Which pointer interaction triggers highlighting. Propagated to other components via `nightingale-manager`. | ||
|
|
||
| #### `highlight-color?: string (default: "#EB3BFF22")` | ||
|
|
||
| Fill colour for highlighted regions. | ||
|
|
||
| #### `use-ctrl-to-zoom?: boolean` | ||
|
|
||
| When set, scrolling only zooms if Ctrl (or Cmd on macOS) is held. Without this flag, any scroll event on the track will zoom. | ||
|
|
||
| ### Other attributes and properties | ||
|
|
||
| This component inherits from `NightingaleElement` and implements the following mixins: `withManager`, `withSVGHighlight` (which includes `withZoom`, `withHighlight`, `withMargin`, `withPosition`, `withResizable`, `withDimensions`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "name": "@nightingale-elements/nightingale-logo-track", | ||
| "version": "5.6.0", | ||
| "description": "Track for rendering sequence logos (information-content stacked letters) from RNA/DNA multiple sequence alignments.", | ||
| "files": [ | ||
| "dist", | ||
| "src" | ||
| ], | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.js", | ||
| "type": "module", | ||
| "types": "dist/index.d.ts", | ||
| "scripts": { | ||
| "build": "rollup --config ../../rollup.config.mjs", | ||
| "test": "../../node_modules/.bin/jest --config ../../jest.config.js ./tests/*" | ||
| }, | ||
| "keywords": [ | ||
| "nightingale", | ||
| "webcomponents", | ||
| "customelements", | ||
| "sequence-logo", | ||
| "rna", | ||
| "msa" | ||
| ], | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/ebi-webcomponents/nightingale.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/ebi-webcomponents/nightingale/issues" | ||
| }, | ||
| "homepage": "https://ebi-webcomponents.github.io/nightingale/", | ||
| "license": "MIT", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "sideEffects": false, | ||
| "dependencies": { | ||
| "@nightingale-elements/nightingale-new-core": "^5.6.0", | ||
| "d3": "7.9.0" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import NightingaleLogoTrack from "./nightingale-logo-track"; | ||
| export type { MsaSequence } from "./nightingale-logo-track"; | ||
| export { NightingaleLogoTrack as default }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
testscript runs jest against./tests/*, but there's notestsfolder in the package yet, soyarn testhere doesn't actually run anything.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved, please check