Skip to content

Repository files navigation

react-sequence-viewer

Description

A React wrapper around the BioJSsequence-viewer component.

Installation

npm install --save react-sequence-viewer

Dependencies

The following are dependencies required by the sequence-viewer module that is wrapped by this React component.

  • jQuery
  • Bootstrap CSS

You can either include these into your HTML page or add them to your own application build (see usage below).

<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><linkrel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>

Usage

The following code renders a sequence-viewer component in the HTML element with an ID of 'sequence-viewer1'.

ES6

importReactfrom'react';importReactDOMfrom'react-dom';// Either uncomment these lines or pull// in jQuery and Bootstrap into the HTML page of your application.// The below requires that jQuery/Bootstrap be installed as a dependency// in your package.json file.//import jquery from 'jquery';//window.jQuery = jquery;//import 'bootstrap/dist/css/bootstrap.min.css';importReactSequenceViewerfrom'react-sequence-viewer';constmySeq='CAGTCGATCGTAGCTAGCTAGCTGATCGATGC';ReactDOM.render(<ReactSequenceViewersequence={mySeq}/>,document.getElementById('#sequence-viewer1'));
importReactfrom'react';importReactDOMfrom'react-dom';// Either uncomment these lines or pull// in jQuery and Bootstrap into the HTML page of your application.// The below requires that jQuery/Bootstrap be installed as a dependency// in your package.json file.//import jquery from 'jquery';//window.jQuery = jquery;//import 'bootstrap/dist/css/bootstrap.min.css';importReactSequenceViewerfrom'react-sequence-viewer';constmySeq='CAGTCGATCGTAGCTAGCTAGCTGATCGATGC';constoptions={badge: true,search: false,showLineNumbers: true,title: "my sequence",toolbar: false,};ReactDOM.render(<ReactSequenceViewersequence={mySeq}{...options}/>,document.getElementById('#sequence-viewer1'));

Properties / Options

Please see the Sequence Viewer documentation for more details on the options below.

NameDescriptionTypeRequiredComment
classNameHTML class name to apply to the Sequence Viewer div containerStringNo
coverageAdvanced sequence hightlightingArray[Objects]NoNot compatible with selection
idThe ID to use for the Sequence Viewer container elementStringNo
legendAdds a legend to the sequenceArray[Objects]No
onMouseSelectionEvent handler for sequence selection with the mousefunctionNo
onSubpartSelectedEvent handler for sequence selected via the search boxfunctionNo
selectionA region to highlightArrayNoNot compatible with coverage
sequenceThe sequence to render.StringYes

About

A React wrapper around the BioJS sequence-viewer component

Topics

Resources

Contributing

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages