-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added code from local repo on my personal github
- Loading branch information
1 parent
327a053
commit 6679286
Showing
11 changed files
with
224 additions
and
2 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,39 @@ | ||
# History files | ||
.Rhistory | ||
.Rapp.history | ||
|
||
# Session Data files | ||
.RData | ||
|
||
# User-specific files | ||
.Ruserdata | ||
|
||
# Example code in package build process | ||
*-Ex.R | ||
|
||
# Output files from R CMD build | ||
/*.tar.gz | ||
|
||
# Output files from R CMD check | ||
/*.Rcheck/ | ||
|
||
# RStudio files | ||
.Rproj.user/ | ||
|
||
# produced vignettes | ||
vignettes/*.html | ||
vignettes/*.pdf | ||
|
||
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 | ||
.httr-oauth | ||
|
||
# knitr and R markdown default cache directories | ||
*_cache/ | ||
/cache/ | ||
|
||
# Temporary files created by R markdown | ||
*.utf8.md | ||
*.knit.md | ||
|
||
# R Environment Variables | ||
.Renviron |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# clustifyr-web-app | ||
An R Shiny App to help with scRNA-seq benchmarking and analysis with Clustifyr | ||
# R-Shiny-App-Practice | ||
A repository to prepare myself for writing an R shiny app for the scRNA-seq atlas web tool |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
rsconnect/shinyapps.io/sidhantpuntambekar/scRNA-seq-atlas.dcf
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 @@ | ||
name: scRNA-seq-atlas | ||
title: scRNA-seq-atlas | ||
username: | ||
account: sidhantpuntambekar | ||
server: shinyapps.io | ||
hostUrl: https://api.shinyapps.io/v1 | ||
appId: 2890325 | ||
bundleId: 3671701 | ||
url: https://sidhantpuntambekar.shinyapps.io/scRNA-seq-atlas/ | ||
when: 1601067752.08105 | ||
asMultiple: FALSE | ||
asStatic: FALSE |
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,171 @@ | ||
library(shiny) | ||
library(dplyr) | ||
library(readr) | ||
library(tools) | ||
library(clustifyr) | ||
library(rsconnect) | ||
options(shiny.maxRequestSize = 1500*1024^2) | ||
options(repos = BiocManager::repositories()) | ||
options(shiny.reactlog = TRUE) | ||
|
||
# Define UI for data upload app ---- | ||
ui <- fluidPage( | ||
|
||
# App title ---- | ||
titlePanel("Clustifyr Reference Matrix Generation"), | ||
|
||
# Sidebar layout with input and output definitions ---- | ||
sidebarLayout( | ||
|
||
# Sidebar panel for inputs ---- | ||
sidebarPanel( | ||
|
||
# Input: Select a file ---- | ||
fileInput("file1", "Choose Matrix File", | ||
multiple = TRUE, | ||
accept = c("text/csv", | ||
"text/comma-separated-values,text/plain", | ||
".csv", | ||
'.xlsx', | ||
".tsv", | ||
".rds", | ||
".rda"), | ||
), | ||
fileInput("file2", "Choose Metadata File", | ||
multiple = FALSE, | ||
accept = c("text/csv", | ||
"text/comma-separated-values,text/plain", | ||
".csv", | ||
'.xlsx', | ||
".tsv", | ||
".rds", | ||
".rda"), | ||
), | ||
|
||
tags$hr(), | ||
|
||
# Input: Checkbox if file has header ---- | ||
checkboxInput("header", "Header", TRUE), | ||
|
||
|
||
# Horizontal line ---- | ||
tags$hr(), | ||
|
||
# Input: Select separator ---- | ||
radioButtons("sep", "Separator", | ||
choices = c(Tab = "\t"), | ||
selected = ","), | ||
|
||
# Input: Select number of rows to display ---- | ||
radioButtons("disp", "Display", | ||
choices = c(Head = "head", | ||
All = "all"), | ||
selected = "head") | ||
|
||
), | ||
|
||
# Main panel for displaying outputs ---- | ||
mainPanel( | ||
|
||
# Output: Data file ---- | ||
tableOutput("contents") | ||
|
||
) | ||
|
||
) | ||
) | ||
|
||
# Define server logic to read selected file ---- | ||
server <- function(input, output) { | ||
|
||
output$contents <- renderTable({ | ||
|
||
# input$file1 will be NULL initially. After the user selects | ||
# and uploads a file, head of that data file by default, | ||
# or all rows if selected, will be shown. | ||
file <- input$file1 | ||
fileTypeFile1 <- tools::file_ext(file$datapath) | ||
req(file) | ||
# when reading semicolon separated files, | ||
# having a comma separator causes `read.csv` to error | ||
if (fileTypeFile1 == "csv") | ||
{ | ||
df1 <- read.csv(file$datapath, | ||
header = input$header, | ||
sep = input$sep, | ||
quote = input$quote) | ||
} | ||
else if (fileTypeFile1 == "tsv") | ||
{ | ||
df1 <- read_tsv(file$datapath, | ||
header = input$header, | ||
quote = input$quote) | ||
} | ||
else | ||
{ | ||
df1 <- load(file$datapath) | ||
} | ||
|
||
#file 1 | ||
if(input$disp == "head") { | ||
return(head(df1)) | ||
} | ||
else { | ||
return(df1) | ||
} | ||
} | ||
) | ||
|
||
output$file2Contents <- renderTable({ | ||
file <- input$file2 | ||
fileTypeFile2 <- tools::file_ext(file$datapath) | ||
req(file) | ||
if (fileTypeFile2 == "csv") | ||
{ | ||
df2 <- read.csv(file$datapath, | ||
header = input$header, | ||
sep = input$sep, | ||
quote = input$quote) | ||
} | ||
else if (fileTypeFile2 == "tsv") | ||
{ | ||
df2 <- read_tsv(file$datapath, | ||
header = input$header, | ||
quote = input$quote) | ||
} | ||
else | ||
{ | ||
df2 <- load(file$datapath) | ||
} | ||
|
||
#file 2 | ||
if(input$disp == "head") { | ||
return(head(df2)) | ||
} | ||
else { | ||
return(df2) | ||
} | ||
} | ||
) | ||
|
||
output$reference <- renderTable({ | ||
req(input$file1) | ||
req(input$file2) | ||
fileTypeFile1 <- file_ext(input$file1) | ||
fileTypeFile2 <- file_ext(input$file2) | ||
df1 <- read.csv(input$file1$datapath, | ||
header = input$header, | ||
sep = input$sep, | ||
quote = input$quote) | ||
df2 <- read.csv(input$file2$datapath, | ||
header = input$header, | ||
sep = input$sep, | ||
quote = input$quote) | ||
reference_matrix <- average_clusters(mat = df1, metadata = df2$cellCol, if_log = TRUE) | ||
head(reference_matrix) | ||
}) | ||
|
||
} | ||
|
||
# Create Shiny app ---- | ||
shinyApp(ui, server) |