Description Usage Arguments Value Examples
View source: R/LIST_ComputeDatatableOptions.R
LIST_ComputeDatatableOptions Insert data table options for automatic inclusion of sparkline javascript code. Need some very secific DATA
1 2 3 4 5 6 7 | LIST_ComputeDatatableOptions(
LIST_SampleNames,
TYPE = "Skeleton",
LIST_SparlinesOptions = list(type = "bar", height = 40, width = 60, highlightColor =
"red", chartRangeMin = 0, chartRangeMax = 1, tooltipFormat =
"{{offset:offset}} {{value.2}}")
)
|
LIST_SampleNames |
List of sample names that will be included for the sparkline |
TYPE |
if it has to be included in a skeleton part or if it has to be included in the app |
LIST_SparlinesOptions |
options to be included in the sparkline |
List of options that will be included in a DT::data.table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | library(data.table)
library(DT)
library(sparkline)
library(htmlwidgets)
P_FilePath <- system.file("extdata",
"peptides.example.txt",
package = "isoformnspectRe")
Peptides<-fread(
P_FilePath,
integer64="double")
SampleNames<-list("siNT"=c("siNT_48-1",
"siNT_48-2",
"siNT_48-3",
"siNT_72-1",
"siNT_72-2",
"siNT_72-3"),
"siSF3B1"=c("siSF3B1-1",
"siSF3B1-2",
"siSF3B1-3",
"siSRSF1-1",
"siSRSF1-2",
"siSRSF1-3"))
Samples <- unlist(SampleNames)
MaxIntensities <- apply(Peptides[,paste("Intensity",Samples),with=FALSE],1,max)
Peptides[,
(paste("Intensity",Samples)) := lapply(.SD, function(x) x/MaxIntensities),
.SDcols = paste("Intensity",Samples)]
Peptides[,"siNT Infos" := paste(.SD, collapse = ","), .SDcols =
paste("Intensity",SampleNames[["siNT"]]), by = Sequence]
Peptides[,"siSF3B1 Infos" := paste(.SD, collapse = ","), .SDcols =
paste("Intensity",SampleNames[["siSF3B1"]]), by = Sequence]
PeptideColumnOfInterest<-c("Proteins","Sequence",
"siNT Infos","siSF3B1 Infos",
"Start position","End position","PEP")
LocalDatatable <- DT::datatable(
Peptides[,..PeptideColumnOfInterest],
width = "100%",
options = LIST_ComputeDatatableOptions(LIST_SampleNames=SampleNames),
rownames = FALSE, escape = FALSE)
LocalDatatable$dependencies <- append(LocalDatatable$dependencies,
htmlwidgets:::getDependency("sparkline"))
LocalDatatable
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.