Skip to content

Commit

Permalink
NightingaleConservationTrack: rename letter-order "property" to "defa…
Browse files Browse the repository at this point in the history
…ult"
  • Loading branch information
midlik committed Jan 21, 2025
1 parent ad0dcf1 commit 3e4730e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions packages/nightingale-conservation-track/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Published on NPM](https://img.shields.io/npm/v/@nightingale-elements/nightingale-conservation-track.svg)](https://www.npmjs.com/package/@nightingale-elements/nightingale-conservation-track)

The `nightingale-conservation-track` component is used to display sequence conservation across a set of sequences. It displays a column for each sequence position, which is divided into rectangles based on probabilities of individual amino acids occurring on this position. Each rectangle contains a label with one-letter code of the amino acid (if space allows). The input sequence conservation data can be provided via the `data` property.
The `nightingale-conservation-track` component is used to display sequence conservation across a set of sequences. It displays a column for each sequence position, which is divided into rectangles based on probabilities of individual amino acids occurring on this position. Each rectangle contains a label with one-letter code of the amino acid (if space allows). Rectangles are colored based on amino acid groups (aromatic, hydrophobic, polar, positive, negative, proline, cysteine, glycine). The input sequence conservation data can be provided via the `data` property.

As `nightingale-conservation-track` implements from `withZoom` and `withHighlight`, it will respond to zooming changes, highlight events and emit events when interacting with features (helpful if you want to display tooltips).

Expand All @@ -15,7 +15,7 @@ Most of the rendering is implemented via HTML canvas, but some non-critical part
id="my-track-id"
height="200"
min-width="200"
letter-order="property"
letter-order="default"
font-family="Helvetica,sans-serif"
min-font-size="6"
fade-font-size="12"
Expand Down Expand Up @@ -50,10 +50,10 @@ track.data = {

### Atributes

#### `letter-order?: "property" | "probability" (default: "property")`
#### `letter-order?: "default" | "probability" (default: "default")`

Order of amino acids within a column (top-to-bottom).
- "property" - fixed order based on amino acid grouping
- "default" - fixed order based on amino acid groups
- "probability" - on every position sort by descending probability

#### `font-family?: string (default: "Helvetica,sans-serif")`
Expand All @@ -78,6 +78,8 @@ Maximum font size for labels. Set equal to `min-font-size` to keep font size con

Gets or sets sequence conservation data. See example above.

The keys in the `probabilities` object are typically one-letter amino acid codes but can be arbitrary strings (e.g. nucleotides: A, C, G, T).

### Other attributes and properties

This component inherits from `NightingaleElement`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ interface YPositions {
end: { [letter: string]: number[] },
}

type LetterOrder = "property" | "probability";
type LetterOrder = "default" | "probability";

/** Type for `NightingaleConservationTrack.data`` */
export interface SequenceConservationData {
Expand All @@ -102,9 +102,9 @@ export default class NightingaleConservationTrack extends withCanvas(
)
)
) {
/** Order of amino acids within a column (top-to-bottom). property = fixed order based on amino acid grouping, probability = on every position sort by descending probability */
/** Order of amino acids within a column (top-to-bottom). default = fixed order based on amino acid groups, probability = on every position sort by descending probability */
@property({ type: String })
"letter-order": LetterOrder = "property";
"letter-order": LetterOrder = "default";

/** Font family for labels (can be a list of multiple font families separated by comma, like in CSS) */
@property({ type: String })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default { title: "Components/Tracks/NightingaleConservationTrack" } as Me


const DefaultArgs = {
"letter-order": "property",
"letter-order": "default",
"min-width": 400,
"height": 200,
"highlight-event": "onmouseover",
Expand All @@ -19,7 +19,7 @@ type Args = typeof DefaultArgs;

const ArgumentTypes: Partial<ArgTypes<Args>> = {
"highlight-event": { control: "select", options: ["onmouseover", "onclick"] },
"letter-order": { control: "select", options: ["property", "probability"] },
"letter-order": { control: "select", options: ["default", "probability"] },
};


Expand Down

0 comments on commit 3e4730e

Please sign in to comment.