LogosJ: Embeddable SVG Sequence Logos
LogosJ is a Javascipt package for creating SVG sequence logos. LogosJ supports a wide range of biological use cases. This README provides a quick overview of LogosJ installation and usage. For detailed examples with code samples are available at our companion site and documentation at GitHub Pages.
LogosJ can be used with and without ReactJS. A companion web app makes it easy to share SVG logos and generate them in batches from the output of common tools such as the MEME Suite.
Using in your web application
You can add LogosJ to your project using NPM or Yarn:
yarn add logosj-react
or
npm install logosj-react
If you want to use LogosJ in a static web page, you can simply include the package with a
static script tag, which will add LogosJ to the global namespace as logosj
:
Quick example: a DNA logo
The transcription factor CTCF binds a well-known consensus DNA sequence, rendered below with LogosJ:
If you use ReactJS, the following code creates the CTCF consensus binding logo:
import DNALogo from 'logosj-react'; const CTCF_PWM = 009 031 008 050 018 015 045 020 030 005 049 014 006 087 002 003 000 098 000 002 081 001 007 009 004 057 036 001 011 047 005 035 093 001 003 001 000 000 099 001 036 000 064 000 005 001 055 037 003 000 097 000 006 000 085 007 011 080 000 007 040 001 055 001 009 053 033 004 012 035 008 043 044 019 029 006; const CTCFLogo = <DNALogo = ="FREQUENCY" />;
If you don't use React, the following code embeds the DNA logo in a div
element: