pgcudahy
pgcudahy

Reputation: 1601

Display html report in jupyter with R

The qa() function of the ShortRead bioconductor library generates quality statistics from fastq files. The report() function then prepares a report of the various measures in an html format. A few other questions on this site have recommended using the display_html() function of IRdisplay to show html in jupyter notebooks using R (irkernel). However it only throws errors for me when trying to display an html report generated by the report() function of ShortRead.

library("ShortRead")
sample_dir <- system.file(package="ShortRead", "extdata", "E-MTAB-1147") # A sample fastq file
qa_object <- qa(sample_dir, "*fastq.gz$")
qa_report <- report(qa_object, dest="test") # Makes a "test" directory containing 'image/', 'index.html' and 'QA.css'
library("IRdisplay")
display_html(file = "test/index.html")

Gives me:

Error in read(file, size): unused argument (size)
Traceback:

1. display_html(file = "test/index.html")
2. display_raw("text/html", FALSE, data, file, isolate_full_html(list(`text/html` = data)))
3. prepare_content(isbinary, data, file)
4. read_all(file, isbinary)

Is there another way to display this report in jupyter with R?

Upvotes: 0

Views: 565

Answers (1)

user3571301
user3571301

Reputation: 11

It looks like there's a bug in the code. The quick fix is to clone the github repo, and make the following edit to the ./IRdisplay/R/utils.r, and on line 38 change the line from:

read(file,size)

to

read(size)

save the file, switch to the parent directory, and create a new tarbal, e.g.

tar -zcf IRdisplay.tgz IRdisplay/

and then re-install your new version, e.g. after re-starting R, type:

install.packages( "IRdisplay.tgz", repo=NULL )

Upvotes: 1

Related Questions