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

@rnacentral/feature-viewer

v1.1.2

Published

A lightweight, generic and easy-to-use feature-viewer written in javascript with D3

Downloads

16

Readme

neXtProt - The knowledge resource on human proteins

This is a code repository for the SIB - Swiss Institute of Bioinformatics CALIPHO group neXtProt project

See: http://www.nextprot.org/

neXtProt feature viewer

DOI

The feature viewer is a super easy javascript library to use in order to draw the different features covering a sequence for a better visualization.

Feature viewer

Live demo : https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/examples/index.html

Getting Started

1. You can get the library in your project using bower or npm

//BOWER//
bower install feature-viewer

//NODE//
npm install feature-viewer

Or Include the feature-viewer JS and CSS from rawgit CDN in the header of your html

<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/dist/feature-viewer.min.css">

<script src="https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/dist/feature-viewer.bundle.js"></script>

NOTE : If you already got the dependencies (D3, Bootstrap & Jquery) in your project, use the simple minified version instead of the bundle :

<script src="https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/dist/feature-viewer.min.js"></script>

2. Specify a div in your html

<div id="fv1"></div>

3. Create an instance of FeatureViewer in javascript with the sequence (or a length), the div in which it will be display and the rendering options of your choice.

//For Node add before : var FeatureViewer = require("feature-viewer");

var ft = new FeatureViewer('MALWMRLLPLLALLALWGPGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLE',
                           '#fv1',
                            {
                                showAxis: true,
                                showSequence: true,
                                brushActive: true, //zoom
                                toolbar:true, //current zoom & mouse position
                                bubbleHelp:true, 
                                zoomMax:50 //define the maximum range of the zoom
                            });
                            
//Instead of a sequence, you can also initialize the feature viewer with a length (integer) :
var ft = new FeatureViewer(213,'#fv1');

4. Finally, add the features

ft.addFeature({
    data: [{x:20,y:32},{x:46,y:100},{x:123,y:167}],
    name: "test feature 1",
    className: "test1", //can be used for styling
    color: "#0F8292",
    type: "rect" // ['rect', 'path', 'line']
});

5. Et voila!

Feature viewer

Functionalities

  • Zoom into the Feature-viewer by selecting a part of the sequence with your mouse. Zoom out with a right-click.
    You can also zoom programmatically with the methods zoom(start,end) and resetZoom()

  • A tooltip appears when the mouse is over a feature, giving its exact positions, and optionally, a description.

  • beside the positions for each element, you can also give a description & an ID, allowing you to link click event on the feature to the rest of your project.

Options

  • Show axis
  • Show sequence
  • Brush active (zoom)
  • Toolbar (current zoom & position)
  • Bubble help
  • Zoom max
  • Features height
  • Offset

ClearInstance()

You may sometimes want to reload your feature-viewer with new parameters. To avoid memory leaks, the method clearInstance() will clear each element & listener for you before you delete the feature-viewer instance.

Documentation

Check out this page for a better understanding of how to use the feature viewer and its possibilities :

  • https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/examples/index.html

Use it with NeXtProt API

It is possible to fill the feature viewer with protein features from NeXtProt, the human protein database.

  • First, find your protein of interest in NeXtProt and get the neXtProt accession (NX_...). (You can find your protein by entering an accession number of another database, like UniProt or Ensembl)
  • Then, check the type of feature in the NeXtProt API that you would like to add to your viewer. For example, "propeptide" or "mature-protein".
  • Include the feature viewer bundle with nextprot to your html : feature-viewer.nextprot.js
  • Finally, create your feature-viewer like this :
//initalize nextprot Client
var applicationName = 'demo app'; //please provide a name for your application
var clientInfo='calipho group at sib'; //please provide some information about you
var nx = new Nextprot.Client(applicationName, clientInfo);
        
//var entry = "NX_P01308";
var isoform = "NX_P01308-1";

// feature viewer options
var options = {showAxis: true, showSequence: true,
brushActive: true, toolbar:true,
bubbleHelp: true, zoomMax:20 };

// Create nextprot feature viewer
nxFeatureViewer(nx, isoform, "#div2", options).then(function(ff){
// Add first custom feature
ff.addFeature({
    data: [{x:20,y:32},{x:46,y:100},{x:123,y:167}],
    name: "test feature 1",
    className: "test1",
    color: "#0F8292",
    type: "rect",
    filter: "type1"
});
// Add second feature from nextprot
var styles = [
    {name: "Propeptide",className: "pro",color: "#B3B3B3",type: "rect",filter:"Processing"}, 
    {name: "Mature protein",className: "mat",color: "#B3B3C2",type: "rect",filter:"Processing"}
 ]; 
ff.addNxFeature(["propeptide","mature-protein"], styles);

Examples

https://search.nextprot.org/entry/NX_P01308/view/proteomics

Support

If you have any problem or suggestion please open an issue here.

Development

git clone https://github.com/calipho-sib/feature-viewer.git

npm install (will install the development dependencies)

bower install (will install the browser dependencies)

...make your changes and modifications...

npm run dist (will create the min & bundle versions in dist/)

npm run build (will create the bundle js & css in build/ for node)

grunt bump (will push and add a new release)

npm publish (will publish in npm)

License

Copyright (c) 2015, SIB Swiss Institute of Bioinformatics

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.