Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scVizIt
Manage
Activity
Members
Labels
Plan
Issues
8
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
CRI
scVizIt
Commits
8b703904
Commit
8b703904
authored
1 year ago
by
Brandon Chen
Browse files
Options
Downloads
Patches
Plain Diff
added download data for per cell expressions
parent
739729c8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vizapp/shinyapp/server.R
+65
-1
65 additions, 1 deletion
vizapp/shinyapp/server.R
vizapp/shinyapp/ui.R
+4
-1
4 additions, 1 deletion
vizapp/shinyapp/ui.R
with
69 additions
and
2 deletions
vizapp/shinyapp/server.R
+
65
−
1
View file @
8b703904
...
@@ -9,7 +9,7 @@ library(data.table)
...
@@ -9,7 +9,7 @@ library(data.table)
source
(
"./functions/SeuratObjectFunctions.R"
)
source
(
"./functions/SeuratObjectFunctions.R"
)
source
(
"./functions/my_ui.R"
)
source
(
"./functions/my_ui.R"
)
astrocyte_flag
<-
T
#Set to true if running on Astrocyte, else, set to false
astrocyte_flag
<-
F
#Set to true if running on Astrocyte, else, set to false
# Determines the location where data gets read from
# Determines the location where data gets read from
# If it is set to FALSE, then data is read from the ./data/ folder
# If it is set to FALSE, then data is read from the ./data/ folder
# If it is set to TRUE, then data is read from the rootdir provided by Astrocyte
# If it is set to TRUE, then data is read from the rootdir provided by Astrocyte
...
@@ -1001,6 +1001,63 @@ server <- function(input, output, session) {
...
@@ -1001,6 +1001,63 @@ server <- function(input, output, session) {
list
(
out
,
all_out
)
list
(
out
,
all_out
)
})
})
single_cell_data
<-
reactive
({
if
(
length
(
input
$
clusters
)
==
0
){
my_clust
=
"none"
}
else
{
my_clust
=
input
$
clusters
}
if
(
length
(
input
$
samples
)
==
0
){
my_samp
=
"none"
}
else
{
my_samp
=
input
$
samples
}
if
(
input
$
subset
==
c
(
"csv"
)){
seuratObject
=
subsetSeuratObject
(
seuratObject
=
samples.integrated
,
cellFile
=
input
$
subset_csv
$
datapath
)
}
if
(
input
$
subset
==
c
(
"manual"
)){
seuratObject
=
subsetSeuratObject
(
seuratObject
=
samples.integrated
,
selectedClusters
=
my_clust
,
selectedSamples
=
my_samp
)
}
if
(
input
$
subset
==
c
(
"none"
))
{
seuratObject
=
subsetSeuratObject
(
seuratObject
=
samples.integrated
,
selectedClusters
=
'none'
,
selectedSamples
=
'none'
)}
if
(
input
$
score_genes
==
T
)
{
seuratObject
=
seuratObject
$
seuratObject
if
(
input
$
log
==
F
)
{
seuratObject
=
NormalizeData
(
seuratObject
,
verbose
=
F
,
normalization.method
=
'RC'
)
}
infoList
=
getInfo
(
seuratObject
,
T
)
signatures
<-
read.csv
(
input
$
g_score
$
datapath
,
sep
=
','
,
header
=
T
)
temp
=
AddModuleScore
(
seuratObject
,
signatures
,
search
=
F
)
g
=
dim
(
signatures
)[
2
]
n
=
dim
(
temp
@
meta.data
)[
2
]
colnames
(
temp
@
meta.data
)[(
n
-
g
+1
)
:
n
]
=
colnames
(
signatures
)
gene_list
=
input
$
signature
if
(
input
$
phasing
==
T
){
temp
@
meta.data
[,
c
(
'orig.ident'
,
'idents'
,
'Phase'
,
gene_list
)]
}
else
{
temp
@
meta.data
[,
c
(
'orig.ident'
,
'idents'
,
gene_list
)]
}
}
else
{
seuratObject
=
seuratObject
$
seuratObject
if
(
input
$
log
==
F
)
{
seuratObject
=
NormalizeData
(
seuratObject
,
verbose
=
F
,
normalization.method
=
'RC'
)
}
gene_list
=
input
$
features
temp
<-
seuratObject
@
assays
$
RNA
$
data
[
gene_list
,]
%>%
as.matrix
()
%>%
t
()
if
(
input
$
phasing
==
T
){
data.frame
(
seuratObject
@
meta.data
[,
c
(
'orig.ident'
,
'idents'
,
'Phase'
)],
temp
,
check.rows
=
F
)
}
else
{
data.frame
(
seuratObject
@
meta.data
[,
c
(
'orig.ident'
,
'idents'
)],
temp
,
check.rows
=
F
)
}
}
})
percent_expression_table
<-
reactive
({
percent_expression_table
<-
reactive
({
phasing
=
input
$
phasing
phasing
=
input
$
phasing
group.by
=
input
$
group
group.by
=
input
$
group
...
@@ -1669,6 +1726,13 @@ server <- function(input, output, session) {
...
@@ -1669,6 +1726,13 @@ server <- function(input, output, session) {
}
}
)
)
output
$
download_single_cell_data
<-
downloadHandler
(
filename
=
function
()
{
paste
(
'Single_Cell_Data'
,
'.csv'
,
sep
=
''
)
},
content
=
function
(
file
)
{
write.csv
(
single_cell_data
(),
file
=
file
)
}
)
output
$
download_DE
<-
downloadHandler
(
output
$
download_DE
<-
downloadHandler
(
filename
=
function
()
{
paste0
(
runDE
()[[
4
]],
"_vs_"
,
runDE
()[[
5
]],
'_DE_Genes.zip'
,
sep
=
''
)
},
filename
=
function
()
{
paste0
(
runDE
()[[
4
]],
"_vs_"
,
runDE
()[[
5
]],
'_DE_Genes.zip'
,
sep
=
''
)
},
content
=
function
(
file
)
{
content
=
function
(
file
)
{
...
...
This diff is collapsed.
Click to expand it.
vizapp/shinyapp/ui.R
+
4
−
1
View file @
8b703904
...
@@ -149,7 +149,10 @@ ui <- fluidPage(
...
@@ -149,7 +149,10 @@ ui <- fluidPage(
column
(
12
,
column
(
12
,
downloadButton
(
"download_data_table"
,
downloadButton
(
"download_data_table"
,
"Download Expression Data"
)
"Download Expression Data"
)
)
),
column
(
12
,
downloadButton
(
"download_single_cell_data"
,
"Download Single Cell Data"
))
# column(12,
# column(12,
# downloadButton("download_percent_expression",
# downloadButton("download_percent_expression",
# "Download Percent Expression Data"))
# "Download Percent Expression Data"))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment