Giter VIP home page Giter VIP logo

nozzle's Introduction

Nozzle

Nozzle is an R package that provides an API to generate HTML reports with dynamic user interface elements based on JavaScript and CSS (Cascading Style Sheets). Nozzle was designed to facilitate summarization and rapid browsing of complex results in data analysis pipelines where multiple analyses are performed frequently on big data sets. The package can be applied to any project where user-friendly reports need to be created.

A paper describing the package was published in Bioinformatics. Please cite this paper if you are using Nozzle in your work:

N Gehlenborg, MS Noble, G Getz, L Chin and PJ Park, "Nozzle: a report generation toolkit for data analysis pipelines", Bioinformatics 29:1089-1091 (2013)

A nozzleized version of the preprint is available on the Nozzle site at the Broad Institute and the source code is included in this repository.

About the Name

The package was orignally developed for a data analysis pipeline called "Firehose" and the name "Nozzle" was chosen because the package is used to focus the output of Firehose. The "R1" in the "Nozzle.R1" package name stands for "revision 1" of the Nozzle R API. All versions of the Nozzle.R1 package will be backwards-compatible and able to render reports generated with earlier versions of the package. When backwards-compatibility of the API can no longer maintained the package name will change to "Nozzle.R2".

Obtaining and Installing the R package

As of version 1.0-0 the R package is available from CRAN and can be installed directly from R:

install.packages( "Nozzle.R1", type="source" );

The package can also be downloaded from the Nozzle site at the Broad Institute. The package has no external dependencies and can be installed by calling the following from the command line:

R CMD install Nozzle.R1

Creating a Basic Report

The following code creates a report with one section and two subsections. The first subsection contains a table and the second subsection contains a paragraph of text:

require( Nozzle.R1 )

# Phase 1: create report elements
r <- newCustomReport( "My Report" );
s <- newSection( "My Section" );
ss1 <- newSection( "My Subsection 1" );
ss2 <- newSection( "My Subsection 2" );
f <- newTable( iris[45:55,], "Iris data." ); # w/ caption
p <- newParagraph( "Some sample text." );

# Phase 2: assemble report structure bottom-up
ss1 <- addTo( ss1, f ); # parent, child_1, ..., child_n 
ss2 <- addTo( ss2, p );
s <- addTo( s, ss1, ss2 );
r <- addTo( r, s );

# Phase 3: render report to file
writeReport( r, filename="my_report" ); # w/o extension

Two files called my_report.html and my_report.RData will be written to the current working directory.

Further Examples

An comprehensive demo that uses almost the complete Nozzle API is in the examples folder. Both the demo.R file and the demo.css file are required for the example to work. The rendered HTML reports can be viewed on the Nozzle site at the Broad Institute.

Building the R package

Nozzle works with R 2.10 or later. Use standard R commands to build the package in the cloned repo directory:

R CMD check Nozzle.R1
R CMD build Nozzle.R1

Updating Documentation

The Nozzle API is documented using the roxygen2 R package. To rebuild the Rd files in the man directory run the following from the R shell (using the cloned repo directory as the working directory):

library(methods);
library(utils);
library(roxygen2);
roxygenize("Nozzle.R1", copy=FALSE);

Minifying Files

The JavaScript and CSS code should be compressed before they can be embedded in the HTML report. If you make changes to any file in the inst directory you need to download the [YUI compressor] (http://yui.github.com/yuicompressor) and run the following from the command line:

java -jar Tools/yuicompressor-2.4.2.jar -o Nozzle.R1/inst/js/nozzle.min.js 	Nozzle.R1/inst/js/nozzle.js
java -jar Tools/yuicompressor-2.4.2.jar -o Nozzle.R1/inst/css/nozzle.print.min.css Nozzle.R1/inst/css/nozzle.print.css
java -jar Tools/yuicompressor-2.4.2.jar -o Nozzle.R1/inst/css/nozzle.min.css Nozzle.R1/inst/css/nozzle.css

Author

Nils Gehlenborg ([[email protected]] (mailto:[email protected]))

Funding

Nozzle was developed with funding from The Cancer Genome Atlas program of the National Cancer Institute, U24 CA143867.

nozzle's People

Contributors

ngehlenborg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nozzle's Issues

Problem showing Chinese characters

If using English coding or Unicode in the browser, Chinese characters failed to show correctly.

When using Chinese character coding, namely GBK, Nozzle report will collapse to a narrow window that couldn't be viewed properly. But, If maximize the browser window, the problem is gone.

asReference should create a link

It would be nice if the reference (i.e. "[#]") was a link that navigates to the associated reference in the references section of the report.

Support different languages

Hi,

It would be nice if Nozzle was able to support languages other than English, such as Mandarin Chinese.

Thank you!

Chinese characters failed to show correctly

the corresponding R script:
setwd('C:/Users/Lenovo/Desktop')

require( "Nozzle.R1" );
#分析方法
r <- newCustomReport( "My Report" );
s1<- newSection('分析方法')

#########
r<- addTo(r,s1)
writeReport(r,filename = 'reports/my_report',credits = FALSE)
neither html nor browser can correctly show Chinese charater.
20191001155735
my_report.html.txt

assign anchors to sections and other report elements

In order to link to sections, figures, tables we would like to define anchors for these elements when their corresponding "newXXX" method is called.

In a perfect world, the "writeReport" method would generate a warning if duplicate anchors exist.

add support for report DOIs

  • DOI should be included in a "How to Cite?" section.
  • a resolver URL should be provided.
  • generate warning/error if a DOI is set and user tries to set another DOI?

Bug in alphanumeric sorting of tables?

There appears to be a small bug, presumably in the javascript, which means that alphanumeric columns in tables cannot be sorted when using Nozzle. Here is a small test example.

library("Nozzle.r1")
num = c(1,2,3,2.1)
txt <- c("aada","aaba", "aaca","aaaa")
alphanum <- c("aad1", "aab2", "aac3", "aaa4")
d <- data.frame(numeric=num, text=txt, alphanumeric=alphanum)
report <- newCustomReport("Alphanumeric sorting test")
t <- newTable(d, "Test table")
report <- addTo(report, t)
writeReport(report, "test")

In the html output, it is possible to sort the "numeric" and "text" columns, but the "alphanumeric" column does not sort correctly.

Any insight gratefully received.

Problem with default encoding set

I found the bug in nozzle report.

In fact, this situation I already reported to Nils, but I can't found the solution in those days.

After about 2 year, finally I found the cause of problem. (guess)

please check this problem

setting a default encoding within the HTML of the report

sadl zk 2015-07-21 00 24 20

sadl zk 2015-07-21 00 24 38

Add collapse control to Section/SubSection/SubSubSection

It would be extremely useful if the following flags were added to new{Section,SubSection,SubSubSection}:

  • collapsable
    • indicate if a Section/SubSection/SubSubSection is collapsable
  • collapsed
    • indicate if a Section/SubSection/SubSubSection begins collapsed (if collapsable is FALSE, this would be force-set to FALSE regardless of user seting)

indent sections for every level

In cases where a subsection is included in a subsection indentation would help to tell different levels of the hierarchy apart.

Allow figures to be 'expanded' by default

Currently, the user needs to click on a figure in order to enlarge it. It would be good one could specify expanded=TRUE in newFigure, so that they are enlarged by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.