Skip to content

timeu/GeneViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is GeneViewer?

GeneViewer is a Google Web Toolkit (GWT) widget containing a processingjs sketch for visualizing gene models.

GeneViewer

How do I use it?

Following steps are required:

GeneViewer geneviewer = new GeneViewer();
geneviewer.load(new Runnable() {
   @Override
   public void run() {
       GWT.log("GeneViewer loaded");
       // Interact with sketch
       JsArrayMixed data = getData();
       geneviewer.setGeneData(data);
   }
});

To display the gene models the user has to call the setGEneData(JsArrayMixed data) function. The JsArrayMixed data consists of a list of genes in JSON format. There are 2 visualization modes:

  1. Simple gene models without any features (See sample data).
  2. Gene Models with features (see sample data and screenshot).

Example of data with features:

   [
     [10421840,10424113,1,"AT2G24530.1",
       [
         [10422416,10422596,1,"five_prime_UTR"],
         [10422272,10422312,1,"five_prime_UTR"],
         [10421840,10421930,1,"five_prime_UTR"],
         [10422416,10424113,1,"exon"],
         [10423820,10424113,1,"three_prime_UTR"],
         [10422272,10422312,1,"exon"],
         [10421840,10421930,1,"exon"],
         [10422596,10423820,1,"CDS"]
       ]
     ],
     [  
       [
         
       ]
     ]
   ]

The data can be loaded this way:

final String jsonData = GET_FROM_CLIENTBUNDLE OR AJAX CALL
JsArrayMixed data = JsonUtils.safeEval(jsonData);

How do I install it?

If you're using Maven, you can add the following to your <dependencies> section:

    <dependency>
      <groupId>com.github.timeu.gwtlibs.geneviewer</groupId>
      <artifactId>geneviewer</artifactId>
      <version>1.0.0</version>
    </dependency>

GeneViewer uses GWT 2.8's new JSInterop feature and thus it has to be enabled in the GWT compiler args. For maven:

<compilerArgs>
    <compilerArg>-generateJsInteropExports</compilerArg>
</compilerArgs>

or passing it to the compiler via -generateJsInteropExports

You can also download the jar directly or check out the source using git from https://github.com/timeu/geneviewer.git and build it yourself. Once you've installed LDViewer, be sure to inherit the module in your .gwt.xml file like this:

    <inherits name='com.github.timeu.gwtlibs.geneviewer.GeneViewer'/>

Where can I learn more?