Display BrowseSeqs output in R Notebook?
1
0
Entering edit mode
@laurenfitch-11575
Last seen 4.0 years ago

I have been using BrowseSeqs from the DECIPHER package to view sequence alignments during analysis. The two output options are to open a browser window or save an HTML file. It would be very useful to have the results display in the R Notebook. Is there any way to do this?

BrowseSeqs DECIPHER notebook rmarkdown • 1.4k views
ADD COMMENT
1
Entering edit mode
Erik Wright ▴ 150
@erik-wright-14386
Last seen 3 months ago
United States

We have figured out a workaround for displaying external html code inside R Notebooks. It is not exactly the same as displaying it in a browser window by itself, but it is better than nothing. First you tell BrowseSeqs() to write the html output to a specific file, and then you use htmltools::includeHTML() to incorporate that file into the R Notebook. For example:

```{r}
library(DECIPHER)
library(knitr)
library(htmltools)
```

```{r}
# load the example DNA sequences
db <- system.file("extdata", "Bacteria_175seqs.sqlite", package="DECIPHER")
dna <- SearchDB(db) # non-coding ribosomal RNA gene sequences

# example of using the defaults with DNA sequences
BrowseSeqs(dna) # view the XStringSet
```

```{r, results = 'asis', echo = FALSE}
TF <- tempfile()

BrowseSeqs(dna,
           htmlFile = TF)

cat(htmltools::includeHTML(TF))
```
ADD COMMENT
0
Entering edit mode

Thanks! I'm creating reports for wet lab scientists at my company and it's very helpful to reduce the number of files they need to view.

ADD REPLY

Login before adding your answer.

Traffic: 876 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6