README.md

biologicSC

Step 1

Clone app from github

git clone git@github.com:decusInLabore/testbiologicSC.git

mv testbiologicSC yourApp

Run development version with default dataset (from Crick DB) locally:
# Set options here
options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode

# Detach all loaded packages and clean your environment
golem::detach_all_attached()
# rm(list=ls(all.names = TRUE))

# Document and reload your package
golem::document_and_reload()

# Run the application
run_app()

Step 2 Option A Create SQLite database with your data

Structure of the data directory that needs to be added to the above app. data ├── connect │   └── db.txt └── pbmc_small_app2_DB

Go to the dir

devtools::install_github("decusinlabore/biologicSC")
library(biologicSC)
library(Seurat)

testObj <- pbmc_small
all.genes <- rownames(testObj)
testObj <- ScaleData(testObj, features = all.genes)
testObj <- RunPCA(testObj, npcs = 3)
testObj <- RunUMAP(testObj, dims = 1:3)

testObj <- FindNeighbors(testObj, dims = 1:3)
testObj <- FindClusters(testObj, resolution = 0.5)

testObj@meta.data[["all"]] <- "all"

testObj@meta.data[["sampleName"]] <- "SampleA"
testObj@meta.data[["sampleColor"]] <- "#009900"

testObj@meta.data[["clusterName"]] <- paste0("Cluster_", as.vector(testObj@meta.data$seurat_clusters))

clusterVec <- unique(testObj@meta.data$clusterName)
clusterCols <- scales::hue_pal()(length(clusterVec))
dfCol <- data.frame(clusterVec, clusterCols)

dfCell <- data.frame(cellID = row.names(testObj@meta.data), clusterName = testObj@meta.data$clusterName) 
dfCell <- merge(dfCell, dfCol, by.x = "clusterName", by.y = "clusterVec")

addVec <- dfCell$clusterCols
names(addVec) <- row.names(dfCell)

testObj <- Seurat::AddMetaData(
                object = testObj, 
                metadata = addVec, 
                "clusterColor"
)

testObj@meta.data[["meta_Region"]] <- "Tumor"
testObj@meta.data[1:20,"meta_Region"] <- "Normal"



params <- scanObjParams(testObj)

seurat2viewer(
    obj = testObj,
    assay = "RNA",
    #slot = "data",
    geneSel = NULL,
    params = params,
    projectName = "pbmc_small_app"
) 

Step 2 Option B your data to remote db

Step 3

Deploy

devtools::install_github("decusinlabore/biologicSC")
library(biologicSC)
library(Seurat)

testObj <- pbmc_small
all.genes <- rownames(testObj)
testObj <- ScaleData(testObj, features = all.genes)
testObj <- RunPCA(testObj, npcs = 3)
testObj <- RunUMAP(testObj, dims = 1:3)

testObj <- FindNeighbors(testObj, dims = 1:3)
testObj <- FindClusters(testObj, resolution = 0.5)

testObj@meta.data[["all"]] <- "all"

testObj@meta.data[["sampleName"]] <- "SampleA"
testObj@meta.data[["sampleColor"]] <- "#009900"

testObj@meta.data[["clusterName"]] <- paste0("Cluster_", as.vector(testObj@meta.data$seurat_clusters))

clusterVec <- unique(testObj@meta.data$clusterName)
clusterCols <- scales::hue_pal()(length(clusterVec))
dfCol <- data.frame(clusterVec, clusterCols)

dfCell <- data.frame(cellID = row.names(testObj@meta.data), clusterName = testObj@meta.data$clusterName) 
dfCell <- merge(dfCell, dfCol, by.x = "clusterName", by.y = "clusterVec")

addVec <- dfCell$clusterCols
names(addVec) <- row.names(dfCell)

testObj <- Seurat::AddMetaData(
                object = testObj, 
                metadata = addVec, 
                "clusterColor"
)

testObj@meta.data[["meta_Region"]] <- "Tumor"
testObj@meta.data[1:20,"meta_Region"] <- "Normal"



params <- scanObjParams(testObj)

seurat2viewer(
    obj = testObj,
    assay = "RNA",
    #slot = "data",
    geneSel = NULL,
    params = params,
    projectName = "pbmc_small_app"
) 

setwd("..")
library(shiny)
runApp("pbmc_small_app")


decusInLabore/biologicSC documentation built on May 24, 2021, 4:11 p.m.