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

lolliplot

v0.11.3

Published

A protein viewer built with d3

Downloads

2

Readme

Protein Lolliplot :lollipop: :bar_chart:

Visualization to view relationship between common mutations and their location on a gene.

IMPORTANT: This library does NOT provide its own d3 object

You must pass in d3 to the constructor function. Currently tested with v3 and v4.

Usage

This library exports a top level constructor function which generates the chart, and a redux store creation function in case you want to set some default store values before the chart function runs. That is optional though, as the default store will be returned from the constructor.

import ProteinLolliplot, { setupStore } from '@oncojs/lolliplot'

let store = setupStore({ domainWidth: 200 })
store.subscribe(() => {
  let state = store.getState()
  // listen for changes  
})

let = {
  reset,
  updateStats,
  draw,
  remove,
  store: defaultStore,
} = ProteinLolliplot(args)

API

type TProteinLolliplotArgs = {
  d3: Object,
  selector: string,
  element: Object,
  data: Object,
  domainWidth: number,
  width: number,
  height: number,
  store?: Object,
  hideStats?: bool,
  animate?: bool,
  selectedMutationClass?: string,
  mutationId?: string,
  yAxisOffset?: number,
  xAxisOffset?: number,
  proteinHeight?: number,
  numXTicks?: number,
  numYTicks?: number,
  proteinDb?: string,
  onMutationClick?: Function,
  onMutationMouseover?: Function,
  onMutationMouseout?: Function,
  onProteinMouseover?: Function,
  onProteinMouseout?: Function,
  onInit?: Function,
}
type TProteinLolliplotReturn = {
  reset: Function,
  updateStats: Function,
  draw: Function,
  remove: Function,
  store: Object,
}

Constructor Arguments

d3: Your supplied d3 object (v3 || v4). Required!

selector: the selector of the element to attach the chart to

element: the element which the viz will attach to. takes precedence over selector

One of selector or element is required!

data: an object containing an array of proteins and an array of mutations Required!

domainWidth: The amino acid length of the transcript

width (optional): width of the chart

height (optional): height of the chart

store (optional): the redux store created by setupStore

hideStats (optional): if true, do not display the summary box next of the chart

animate (optional): animate the view to the new zoom area. defaults to true

selectedMutationClass (optional): sets the default filter on the mutation class (Consequence, Impact, etc)

mutationId (optional): will highlight the mutation matching this id

yAxisOffset (optional): The padding between the left side of the chart and the y axis

xAxisOffset (optional): The padding between the bottom of the chart and the x axis

proteinHeight (optional): The height of the protein row under the main chart

onInit (optional): will run once everything has been setup

Mouse events

Receive (data, event) as arguments.

onMutationClick (optional) onMutationMouseover (optional) onMutationMouseout (optional) onProteinMouseover (optional) onProteinMouseout (optional)

Returned Object

reset: Sets the most zoomed out position, and resets any filter options

updateStats: Force the stats to update itself based on the current chart zoom level

draw: Re-renders the chart (will call recursively while store.getState().animating === true)

remove: Removes the chart from the DOM and any event handlers created during setup

store: The redux store passed in during creation, or the default one if not

Development

Install / Run Dev Server

yarn && yarn start

Then go to http://localhost:8080/