diff --git a/README.md b/README.md index cc81252..02b6963 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,60 @@ ![](https://github.com/fgcz/bfabric/workflows/R-CMD-check-bfabric/badge.svg) -# bfabric R package +# bfabricShiny R package -enables connecting R and bfabric using REST +## Demonstration +1. enables connecting R and bfabric using REST ![bfabricPy-read-R](https://user-images.githubusercontent.com/4901987/65041207-7c757c80-d956-11e9-90ca-9c3e2e0ca724.gif) +2. command line triggered analytics -# INSTALL +![code_snippet_demo](https://user-images.githubusercontent.com/4901987/181242377-a9bf3988-b193-494c-91c9-a010500ee3f2.gif) + +```{r} +## R --no-save < code_snippet.R +## devtools::install_github("fgcz/bfabricShiny") +## devtools::install_github("fgcz/rawDiag") +stopifnot(R.Version()['major'] >= '4', + require('rawDiag'), + require('bfabricShiny')) + +## Define B-Fabric input workunit +workunitid <- 165473 + +## Query metadata from B-Fabric +Q <- bfabricShiny::read(login, webservicepassword, + endpoint = 'resource', + query = list('workunitid' = workunitid), as_data_frame=FALSE) + +## setting root directory +rawfilenames <- Q$res |> + sapply(function(x)file.path('/srv/www/htdocs/', x$relativepath)) + +## Extract MS data from BLOBs using the rawDiag R package +## That requires storage access via SSH, NFS, or SAMBA +RAW <- rawfilenames |> + parallel::mclapply(rawDiag::read.raw, mc.cores = 12) |> + base::Reduce(f = rbind) + +## Print a summary +RAW |> rawDiag::summary.rawDiag() + +## Have fun with visualization https://doi.org/10.1021/acs.jproteome.8b00173 +## (a) +RAW |> rawDiag::PlotPrecursorHeatmap(bins = 25) +## (b) +RAW |> rawDiag::PlotPrecursorHeatmap(bins = 25) + + ggplot2::facet_wrap(~ filename) +## (c) +RAW |> rawDiag::PlotTicBasepeak(method = 'overlay') +## (d) +RAW |> rawDiag::PlotInjectionTime(method = 'overlay') +``` + + +## INSTALL ```{bash} apt-get install r-base libcurl4-openssl-dev @@ -28,8 +74,7 @@ devtools::install_github('fgcz/bfabricShiny', build_vignettes = FALSE, quiet = F ``` -# Demonstration - +# Use cases ## Run shiny based queue generator application @@ -284,49 +329,3 @@ The idea is to fetch a RData file stored in bfabric. -## Command Line Triggered Visual Exploration - - -![code_snippet_demo](https://user-images.githubusercontent.com/4901987/181242377-a9bf3988-b193-494c-91c9-a010500ee3f2.gif) - - -```{r} -## R --no-save < code_snippet.R -## devtools::install_github("fgcz/bfabricShiny") -## devtools::install_github("fgcz/rawDiag") -stopifnot(R.Version()['major'] >= '4', - require('rawDiag'), - require('bfabricShiny')) - -## Define B-Fabric input workunit -workunitid <- 165473 - -## Query metadata from B-Fabric -Q <- bfabricShiny::read(login, webservicepassword, - endpoint = 'resource', - query = list('workunitid' = workunitid), as_data_frame=FALSE) - -## setting root directory -rawfilenames <- Q$res |> - sapply(function(x)file.path('/srv/www/htdocs/', x$relativepath)) - -## Extract MS data from BLOBs using the rawDiag R package -## That requires storage access via SSH, NFS, or SAMBA -RAW <- rawfilenames |> - parallel::mclapply(rawDiag::read.raw, mc.cores = 12) |> - base::Reduce(f = rbind) - -## Print a summary -RAW |> rawDiag::summary.rawDiag() - -## Have fun with visualization https://doi.org/10.1021/acs.jproteome.8b00173 -## (a) -RAW |> rawDiag::PlotPrecursorHeatmap(bins = 25) -## (b) -RAW |> rawDiag::PlotPrecursorHeatmap(bins = 25) + - ggplot2::facet_wrap(~ filename) -## (c) -RAW |> rawDiag::PlotTicBasepeak(method = 'overlay') -## (d) -RAW |> rawDiag::PlotInjectionTime(method = 'overlay') -```