forked from iSEE/isee-shiny-contest
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2d47454
Showing
9 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
# Essentials ---- | ||
|
||
install.packages("BiocManager") | ||
BiocManager::install("iSEE") | ||
install.packages("rsconnect") | ||
|
||
# GitHub ---- | ||
|
||
# For some reason rsconnect::deployApp() doesn't seem to like GitHub | ||
# install.packages("devtools") | ||
# devtools::install_github("csoneson/iSEE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Due to the memory limit on RStudio Cloud sessions, the full "allen" dataset could not be used for the demo. | ||
# This script was run on a local machine to load and subset the "allen" dataset. | ||
# The RDS file containing the subset was then uploaded to a Dropbox account from which it was downloaded from the RStudio Cloud session. | ||
# Please refer to "02-subset-download.R" for that last step. | ||
|
||
library(scRNAseq) | ||
data("allen") | ||
|
||
# Subset assays ---- | ||
assayNames(allen) | ||
assay(allen, "counts") <- assay(allen, "tophat_counts") | ||
for (x in setdiff(assayNames(allen), "counts")) { | ||
assay(allen, x) <- NULL | ||
} | ||
allen | ||
|
||
# Subset colData ---- | ||
colnames(colData(allen)) | ||
colData(allen) <- colData(allen)[, c("NREADS", "driver_1_s", "dissection_s", "Core.Type", "passes_qc_checks_s")] | ||
|
||
# There is no colData ---- | ||
rowData(allen) | ||
|
||
# Drop metadata ---- | ||
metadata(allen) <- list() | ||
|
||
# Normalize ---- | ||
library(scater) | ||
sce <- as(allen, "SingleCellExperiment") | ||
sce <- normalize(sce) | ||
|
||
# Add reduced dimensions ---- | ||
sce <- runPCA(sce, ncomponents=4) | ||
sce <- runTSNE(sce) | ||
|
||
# Subset features ---- | ||
keep <- which(order(rowVars(assay(sce, "logcounts"))) <= 500) # keep 500 most variable | ||
sce <- sce[keep, ] | ||
|
||
# Add rowData ---- | ||
rowData(sce)$ave_count <- rowMeans(counts(sce)) | ||
rowData(sce)$n_cells <- rowSums(counts(sce)>0) | ||
sce | ||
|
||
# save to RDS ---- | ||
saveRDS(sce, "allen.subset.rds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Due to the memory limit on RStudio Cloud sessions, the full "allen" dataset could not be used for the demo. | ||
# This script was run from the RStudio Cloud session to download a subset of the data, preprocessed on a local machine. | ||
# Please refer to "01-subset-allen.R" for the preprocessing. | ||
|
||
|
||
BiocManager::install("BiocFileCache") | ||
|
||
library(BiocFileCache) | ||
bfc <- BiocFileCache() | ||
|
||
url <- "https://www.dropbox.com/s/yps03y6ws8rtc1h/allen.subset.rds?dl=1" | ||
if (identical(nrow(bfcquery(bfc, "AllenSubset")), 0L)) { | ||
add5 <- bfcadd(bfc, "AllenSubset", fpath=url) | ||
} | ||
rid5 <- names(add5) | ||
|
||
file.copy(add5, "allen.subset.rds") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
library(rsconnect) | ||
# rsconnect::setAccountInfo(name='kevinrue', token='xxxx', secret='xxx') | ||
options(repos = BiocManager::repositories()) | ||
rsconnect::deployApp() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
library(SingleCellExperiment) | ||
sce <- readRDS("allen.subset.rds") | ||
|
||
library(iSEE) | ||
library(shiny) | ||
|
||
# Preload the tour, so that it opens on startup | ||
tour <- read.delim(system.file(package = "iSEE", "extdata", "intro_firststeps.txt"), header = TRUE, sep = ";") | ||
packageVersion("iSEE") | ||
iSEE(sce, tour = tour) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: isee-shiny-contest | ||
title: iSEE app using a subset of the allen dataset | ||
username: kevinrue | ||
account: kevinrue | ||
server: shinyapps.io | ||
hostUrl: https://api.shinyapps.io/v1 | ||
appId: 735398 | ||
bundleId: 1894024 | ||
url: https://kevinrue.shinyapps.io/isee-shiny-contest/ | ||
when: 1550950950.2006 |