Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sc-TissueMapper_Pr
Manage
Activity
Members
Labels
Plan
Issues
0
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
Container Registry
Operate
Environments
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
Strand Lab
sc-TissueMapper_Pr
Commits
ca833df4
Commit
ca833df4
authored
6 years ago
by
Gervaise Henry
Browse files
Options
Downloads
Patches
Plain Diff
Add QuSAGE for large datasets
parent
ab0a1b33
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
r.scripts/sc-TissueMapper.R
+74
-0
74 additions, 0 deletions
r.scripts/sc-TissueMapper.R
with
74 additions
and
0 deletions
r.scripts/sc-TissueMapper.R
+
74
−
0
View file @
ca833df4
...
...
@@ -591,6 +591,80 @@ scQuSAGE <- function(sc10x,gs,res.use=0.1,ds=25000,nm="Lin",folder="lin"){
}
scQuSAGElg
<-
function
(
sc10x
,
gs
,
ds
=
25000
,
nm
=
"Lin"
,
folder
=
"lin"
){
#Runs QuSAGE
#Inputs:
#sc10x = Seruat object
#gs = geneset to use for correlationtable
#nm = name of test
#folder = folder for output
#Outputs:
#correlation table
#Downsample and store expression matrix for QuSAGE
sc10x
<-
SetAllIdent
(
object
=
sc10x
,
id
=
nm
)
clusters
<-
unique
(
sc10x
@
ident
)
labels
<-
as.vector
(
factor
(
sc10x
@
ident
))
if
(
ncol
(
sc10x
@
data
)
<
ds
){
rnd
<-
sample
(
1
:
ncol
(
sc10x
@
data
),
ds
)
data
<-
sc10x
@
data
[,
rnd
]
labels
<-
labels
[
rnd
]
}
else
{
data
<-
sc10x
@
data
}
data
<-
as.data.frame
(
as.matrix
(
data
))
#Make labels for QuSAGE
clust
<-
list
()
clust.comp
<-
list
()
for
(
i
in
clusters
){
t
<-
labels
t
[
!
(
t
==
i
)]
<-
"REST"
clust
[
i
]
<-
list
(
i
=
t
)
rm
(
t
)
clust.comp
[
i
]
<-
paste0
(
i
,
"-REST"
)
}
#Run QuSAGE
for
(
i
in
clusters
){
assign
(
paste0
(
"results."
,
i
),
qusage
(
data
,
unlist
(
clust
[
i
]),
unlist
(
clust.comp
[
i
]),
gs
))
}
#Generate ID table
results.cor
<-
NULL
results.cor
<-
qsTable
(
get
(
paste0
(
"results."
,
clusters
[
1
])),
number
=
length
(
gs
))
results.cor
$
Cluster
<-
clusters
[
1
]
for
(
i
in
clusters
[
-1
]){
qs
<-
qsTable
(
get
(
paste0
(
"results."
,
i
)),
number
=
length
(
gs
))
qs
$
Cluster
<-
i
results.cor
<-
rbind
(
results.cor
,
qs
)
}
results.cor
<-
results.cor
[,
-3
]
rownames
(
results.cor
)
<-
NULL
#Plot correlation plot
for
(
i
in
clusters
){
qs
<-
get
(
paste0
(
"results."
,
i
))
postscript
(
paste0
(
"./analysis/cor/QuSAGE_"
,
i
,
"."
,
folder
,
".eps"
))
plotCIs
(
qs
,
path.index
=
1
:
numPathways
(
qs
))
dev.off
()
tab
<-
qsTable
(
qs
,
number
=
numPathways
(
qs
),
sort.by
=
"logFC"
)
tab
<-
tab
[
tab
$
FDR
<
0.05
,]
tab
<-
tab
[
tab
$
log.fold.change
>
0
,]
tab
<-
tab
[
order
(
-
tab
[,
2
]),]
write.table
(
tab
,
file
=
paste0
(
"./analysis/cor/QuSAGE_"
,
i
,
"."
,
folder
,
".Table.csv"
),
row.names
=
TRUE
,
col.names
=
NA
,
append
=
FALSE
,
sep
=
","
)
}
return
(
results.cor
)
}
scNE
<-
function
(
sc10x
,
neg
=
"EurUro"
){
#Runs custom PCA analysis for NE ID
...
...
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