npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nightingale-elements/nightingale-variation

v5.3.2

Published

Variation viewer component

Downloads

267

Readme

nightingale-variation

Published on NPM

This custom element displays a matrix of amino acid changes at a given position on the protein sequence. The advantage of a matrix-based approach is that even with a large number of variants (every single amino acid change per location) the space taken by the visualisation on the screen doesn't change.

Usage

<nightingale-variation
  protein-api
  id="variationId"
  height="500"
  length="123"
></nightingale-variation>

Setting the data through property

const track = document.querySelector("#variationId");
track.data = myDataObject;

API Reference

Atributes

protein-api?: boolean (default: false)

Indicates that the data provided follows the format of the UniProt Protein API.

See more details in the typescript definition on this file.

row-height?: number (default: undefined)

The height per row of amino acids. If this value is undefined it will be calculated spliting the value given in height among the aminoacids to display. Notice the number of amino acids might vary if the condensed-view is enabled.

Note: If neither row-height nor height is set, it will used the track default height wich is likely set to 10 and probably not how you want to display this moponent as it will overlap rows.

condensed-view?: boolean (default: false)

If enabled, only displays a row for amino acids with at least one variant.

Properties

data: VariationData|ProteinsAPIVariation

Data to be loaded in the component. It uses one of two formats:

  1. If the protein-api attribute is present, it uses the format defined in the UniProt Protein API, described in Typescript as:

    type ProteinsAPIVariation = {
      accession: string;
      entryName: string;
      proteinName: string;
      geneName: string;
      organismName: string;
      proteinExistence: string;
      sequence: string;
      sequenceChecksum: string;
      sequenceVersion: number;
      taxid: number;
      features: Variant[];
    };
  2. The format used internally in the component.

    export type VariationDatum = {
      accession: string;
      variant: string;
      start: number;
      size?: number;
      xrefNames: string[];
      hasPredictions: boolean;
      tooltipContent?: string;
      alternativeSequence?: string;
      internalId?: string;
      wildType?: string;
      color?: string;
    };
    
    export type VariationData = {
      sequence: string;
      variants: VariationDatum[];
    };

colorConfig: (v: VariationDatum) => string;

A function that receives a variation datapoint and returns an HTML valid color. For example:

const track = document.querySelector("#variationId");
track.colorConfig = (v: VariationDatum) => {
  if (v.hasPredictions) return "green";
  return "#DD2121";
};