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
e1baf4eb
Commit
e1baf4eb
authored
7 years ago
by
Gervaise Henry
Browse files
Options
Downloads
Patches
Plain Diff
Add Lineage UK cells to St for analysis
parent
cf73641c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
r.scripts/sc_LineageSubClust.R
+3
-41
3 additions, 41 deletions
r.scripts/sc_LineageSubClust.R
r.scripts/sc_MergeSubClust.R
+1
-5
1 addition, 5 deletions
r.scripts/sc_MergeSubClust.R
r.scripts/sc_QuSAGE_UKSubClust.R
+0
-523
0 additions, 523 deletions
r.scripts/sc_QuSAGE_UKSubClust.R
with
4 additions
and
569 deletions
r.scripts/sc_LineageSubClust.R
100644 → 100755
+
3
−
41
View file @
e1baf4eb
...
@@ -47,25 +47,18 @@ if (!dir.exists(paste0("./analysis/",opt$g,"/global",sub.folder))){
...
@@ -47,25 +47,18 @@ if (!dir.exists(paste0("./analysis/",opt$g,"/global",sub.folder))){
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
sc10x.Group.Epi
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
"Epi"
)
sc10x.Group.Epi
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
"Epi"
)
sc10x.Group.St
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
"St"
)
sc10x.Group.St
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
"St"
)
UK
<-
TRUE
tryCatch
({
tryCatch
({
sc10x.Group.
UK
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
"?"
)
sc10x.Group.
St
<-
SubsetData
(
object
=
sc10x.Group
,
ident.use
=
c
(
"St"
,
"?"
)
)
},
error
=
function
(
e
){
UK
<<-
FALSE
})
},
error
=
function
(
e
){
cat
(
"ERROR : "
,
conditionMessage
(
e
),
"/\n"
)
})
rm
(
sc10x.Group
)
rm
(
sc10x.Group
)
#re-detect variable genes in Epi + St subsets
#re-detect variable genes in Epi + St subsets
sc10x.Group.Epi
<-
FindVariableGenes
(
object
=
sc10x.Group.Epi
,
mean.function
=
ExpMean
,
dispersion.function
=
LogVMR
,
x.low.cutoff
=
0.0125
,
x.high.cutoff
=
3
,
y.cutoff
=
0.5
,
do.plot
=
FALSE
)
sc10x.Group.Epi
<-
FindVariableGenes
(
object
=
sc10x.Group.Epi
,
mean.function
=
ExpMean
,
dispersion.function
=
LogVMR
,
x.low.cutoff
=
0.0125
,
x.high.cutoff
=
3
,
y.cutoff
=
0.5
,
do.plot
=
FALSE
)
sc10x.Group.St
<-
FindVariableGenes
(
object
=
sc10x.Group.St
,
mean.function
=
ExpMean
,
dispersion.function
=
LogVMR
,
x.low.cutoff
=
0.0125
,
x.high.cutoff
=
3
,
y.cutoff
=
0.5
,
do.plot
=
FALSE
)
sc10x.Group.St
<-
FindVariableGenes
(
object
=
sc10x.Group.St
,
mean.function
=
ExpMean
,
dispersion.function
=
LogVMR
,
x.low.cutoff
=
0.0125
,
x.high.cutoff
=
3
,
y.cutoff
=
0.5
,
do.plot
=
FALSE
)
if
(
UK
==
TRUE
){
sc10x.Group.UK
<-
FindVariableGenes
(
object
=
sc10x.Group.UK
,
mean.function
=
ExpMean
,
dispersion.function
=
LogVMR
,
x.low.cutoff
=
0.0125
,
x.high.cutoff
=
3
,
y.cutoff
=
0.5
,
do.plot
=
FALSE
)
}
#re-PCA on new variable genes
#re-PCA on new variable genes
sc10x.Group.Epi
<-
RunPCA
(
object
=
sc10x.Group.Epi
,
pc.genes
=
sc10x.Group.Epi
@
var.genes
,
do.print
=
FALSE
,
pcs.compute
=
50
)
sc10x.Group.Epi
<-
RunPCA
(
object
=
sc10x.Group.Epi
,
pc.genes
=
sc10x.Group.Epi
@
var.genes
,
do.print
=
FALSE
,
pcs.compute
=
50
)
sc10x.Group.St
<-
RunPCA
(
object
=
sc10x.Group.St
,
pc.genes
=
sc10x.Group.St
@
var.genes
,
do.print
=
FALSE
,
pcs.compute
=
50
)
sc10x.Group.St
<-
RunPCA
(
object
=
sc10x.Group.St
,
pc.genes
=
sc10x.Group.St
@
var.genes
,
do.print
=
FALSE
,
pcs.compute
=
50
)
if
(
UK
==
TRUE
){
sc10x.Group.UK
<-
RunPCA
(
object
=
sc10x.Group.UK
,
pc.genes
=
sc10x.Group.St
@
var.genes
,
do.print
=
FALSE
,
pcs.compute
=
50
)
}
#generate QC figures
#generate QC figures
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/qc/Plot_PCElbow.Epi.eps"
))
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/qc/Plot_PCElbow.Epi.eps"
))
...
@@ -80,14 +73,6 @@ plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(si
...
@@ -80,14 +73,6 @@ plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(si
plot
(
plot
)
plot
(
plot
)
dev.off
()
dev.off
()
if
(
UK
==
TRUE
){
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/qc/Plot_PCElbow.UK.eps"
))
plot
<-
PCElbowPlot
(
object
=
sc10x.Group.UK
,
num.pc
=
50
)
plot
<-
plot
+
theme
(
axis.text.x
=
element_text
(
size
=
20
),
axis.text.y
=
element_text
(
size
=
20
),
axis.title.x
=
element_text
(
size
=
20
),
axis.title.y
=
element_text
(
size
=
20
))
plot
(
plot
)
dev.off
()
}
#re-generate tSNE dimensions and generage sample figures
#re-generate tSNE dimensions and generage sample figures
sc10x.Group.Epi
<-
RunTSNE
(
object
=
sc10x.Group.Epi
,
dims.use
=
1
:
PC.Max
,
do.fast
=
TRUE
)
sc10x.Group.Epi
<-
RunTSNE
(
object
=
sc10x.Group.Epi
,
dims.use
=
1
:
PC.Max
,
do.fast
=
TRUE
)
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/global/NoStress/tSNE_Sample.Epi.eps"
))
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/global/NoStress/tSNE_Sample.Epi.eps"
))
...
@@ -105,29 +90,13 @@ plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
...
@@ -105,29 +90,13 @@ plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot
(
plot
)
plot
(
plot
)
dev.off
()
dev.off
()
if
(
UK
==
TRUE
){
sc10x.Group.UK
<-
RunTSNE
(
object
=
sc10x.Group.UK
,
dims.use
=
1
:
PC.Max
,
do.fast
=
TRUE
)
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/global/NoStress/tSNE_Sample.UK.eps"
))
plot
<-
TSNEPlot
(
object
=
sc10x.Group.UK
,
group.by
=
"samples"
,
pt.size
=
2.5
,
do.return
=
TRUE
)
plot
<-
plot
+
theme
(
axis.text.x
=
element_text
(
size
=
20
),
axis.text.y
=
element_text
(
size
=
20
),
axis.title.x
=
element_text
(
size
=
20
),
axis.title.y
=
element_text
(
size
=
20
),
legend.text
=
element_text
(
size
=
20
))
plot
<-
plot
+
guides
(
colour
=
guide_legend
(
override.aes
=
list
(
size
=
10
)))
plot
(
plot
)
dev.off
()
}
#re-cluster at different resolutions and generate figures
#re-cluster at different resolutions and generate figures
if
(
UK
==
TRUE
){
pops
<-
c
(
"Epi"
,
"St"
)
pops
<-
c
(
"Epi"
,
"St"
,
"UK"
)
}
else
{
pops
<-
c
(
"Epi"
,
"St"
)
}
for
(
j
in
pops
){
for
(
j
in
pops
){
if
(
j
==
"Epi"
){
if
(
j
==
"Epi"
){
sc10x.Group
<-
sc10x.Group.Epi
sc10x.Group
<-
sc10x.Group.Epi
}
else
if
(
j
==
"St"
)
{
}
else
if
(
j
==
"St"
)
{
sc10x.Group
<-
sc10x.Group.St
sc10x.Group
<-
sc10x.Group.St
}
else
if
(
j
==
"UK"
)
{
sc10x.Group
<-
sc10x.Group.UK
}
}
for
(
i
in
c
(
5
,
2
,
1
,
0.5
,
0.2
,
0.1
)){
for
(
i
in
c
(
5
,
2
,
1
,
0.5
,
0.2
,
0.1
)){
gc
()
gc
()
...
@@ -145,8 +114,6 @@ for (j in pops){
...
@@ -145,8 +114,6 @@ for (j in pops){
sc10x.Group.Epi
<-
sc10x.Group
sc10x.Group.Epi
<-
sc10x.Group
}
else
if
(
j
==
"St"
){
}
else
if
(
j
==
"St"
){
sc10x.Group.St
<-
sc10x.Group
sc10x.Group.St
<-
sc10x.Group
}
else
{
sc10x.Group.UK
<-
sc10x.Group
}}
}}
rm
(
pops
)
rm
(
pops
)
rm
(
sc10x.Group
)
rm
(
sc10x.Group
)
...
@@ -162,13 +129,8 @@ rm(opt)
...
@@ -162,13 +129,8 @@ rm(opt)
#save subcluster .Rda files
#save subcluster .Rda files
save
(
sc10x.Group.Epi
,
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
"."
,
opt.subclust
$
g
,
".EpiSubcluster"
,
sub.file
,
".Rda"
))
save
(
sc10x.Group.Epi
,
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
"."
,
opt.subclust
$
g
,
".EpiSubcluster"
,
sub.file
,
".Rda"
))
save
(
sc10x.Group.St
,
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
"."
,
opt.subclust
$
g
,
".StSubcluster"
,
sub.file
,
".Rda"
))
save
(
sc10x.Group.St
,
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
"."
,
opt.subclust
$
g
,
".StSubcluster"
,
sub.file
,
".Rda"
))
if
(
UK
==
TRUE
){
save
(
sc10x.Group.UK
,
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
"."
,
opt.subclust
$
g
,
".UKSubcluster"
,
sub.file
,
".Rda"
))
}
rm
(
UK
)
rm
(
sc10x.Group.Epi
)
rm
(
sc10x.Group.Epi
)
rm
(
sc10x.Group.St
)
rm
(
sc10x.Group.St
)
rm
(
sc10x.Group.UK
)
rm
(
sub.folder
)
rm
(
sub.folder
)
rm
(
sub.file
)
rm
(
sub.file
)
save.image
(
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
".Cumulative.RData"
))
save.image
(
file
=
paste0
(
"./analysis/sc10x."
,
Project.Name
,
".Cumulative.RData"
))
This diff is collapsed.
Click to expand it.
r.scripts/sc_MergeSubClust.R
+
1
−
5
View file @
e1baf4eb
...
@@ -43,12 +43,10 @@ if (!dir.exists(paste0("./analysis/",opt$g,"/global",sub.folder))){
...
@@ -43,12 +43,10 @@ if (!dir.exists(paste0("./analysis/",opt$g,"/global",sub.folder))){
#merge Epi and St SubClust and generate tSNEs
#merge Epi and St SubClust and generate tSNEs
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
Epi.cell
<-
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"Epi"
])
Epi.cell
<-
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"Epi"
])
St.cell
<-
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"St"
])
St.cell
<-
c
(
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"St"
]),
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"?"
]))
UK.cell
<-
names
(
sc10x.Group
@
ident
[
sc10x.Group
@
ident
==
"?"
])
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
Epi.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$Epi.res"
,
opt
$
r
,
"[sc10x.Group@ident=='Epi']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
Epi.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$Epi.res"
,
opt
$
r
,
"[sc10x.Group@ident=='Epi']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
St.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$St.res"
,
opt
$
r
,
"[sc10x.Group@ident=='St']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
St.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$St.res"
,
opt
$
r
,
"[sc10x.Group@ident=='St']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
UK.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$UK.res"
,
opt
$
r
,
"[sc10x.Group@ident=='?']"
))))
sc10x.Group
<-
StashIdent
(
object
=
sc10x.Group
,
save.name
=
paste0
(
"SubClust.res"
,
opt
$
r
))
sc10x.Group
<-
StashIdent
(
object
=
sc10x.Group
,
save.name
=
paste0
(
"SubClust.res"
,
opt
$
r
))
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/global"
,
sub.folder
,
"/tSNE_Global.Merge.res"
,
opt
$
r
,
".eps"
))
postscript
(
paste0
(
"./analysis/"
,
opt
$
g
,
"/global"
,
sub.folder
,
"/tSNE_Global.Merge.res"
,
opt
$
r
,
".eps"
))
plot
<-
TSNEPlot
(
object
=
sc10x.Group
,
pt.size
=
5
,
do.label
=
TRUE
,
label.size
=
10
,
do.return
=
TRUE
)
plot
<-
TSNEPlot
(
object
=
sc10x.Group
,
pt.size
=
5
,
do.label
=
TRUE
,
label.size
=
10
,
do.return
=
TRUE
)
...
@@ -60,7 +58,6 @@ dev.off()
...
@@ -60,7 +58,6 @@ dev.off()
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
sc10x.Group
<-
SetAllIdent
(
object
=
sc10x.Group
,
id
=
"Lineage"
)
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
Epi.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$Epi.sub."
,
opt
$
e
,
"[sc10x.Group@ident=='Epi']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
Epi.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$Epi.sub."
,
opt
$
e
,
"[sc10x.Group@ident=='Epi']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
St.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$St.sub."
,
opt
$
s
,
"[sc10x.Group@ident=='St']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
St.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$St.sub."
,
opt
$
s
,
"[sc10x.Group@ident=='St']"
))))
sc10x.Group
<-
SetIdent
(
object
=
sc10x.Group
,
cells.use
=
UK.cell
,
ident.use
=
eval
(
parse
(
text
=
paste0
(
"sc10x.Group@meta.data$UK.sub."
,
opt
$
s
,
"[sc10x.Group@ident=='?']"
))))
sc10x.Group
@
ident
<-
factor
(
sc10x.Group
@
ident
,
levels
=
c
(
sc10x.Group
@
ident
<-
factor
(
sc10x.Group
@
ident
,
levels
=
c
(
unique
(
as.character
(
sc10x.Group
@
ident
)[
grep
(
"^Epi"
,
as.character
(
sc10x.Group
@
ident
))]),
unique
(
as.character
(
sc10x.Group
@
ident
)[
grep
(
"^Epi"
,
as.character
(
sc10x.Group
@
ident
))]),
unique
(
as.character
(
sc10x.Group
@
ident
)[
grep
(
"^BE"
,
as.character
(
sc10x.Group
@
ident
))]),
unique
(
as.character
(
sc10x.Group
@
ident
)[
grep
(
"^BE"
,
as.character
(
sc10x.Group
@
ident
))]),
...
@@ -90,7 +87,6 @@ dev.off()
...
@@ -90,7 +87,6 @@ dev.off()
rm
(
plot
)
rm
(
plot
)
rm
(
Epi.cell
)
rm
(
Epi.cell
)
rm
(
St.cell
)
rm
(
St.cell
)
rm
(
UK.cell
)
#make generic variables of run specific variables
#make generic variables of run specific variables
Group.List
<-
c
(
Group.List
,
paste0
(
"SubClust.res"
,
opt
$
r
),
"SubClust.ID"
)
Group.List
<-
c
(
Group.List
,
paste0
(
"SubClust.res"
,
opt
$
r
),
"SubClust.ID"
)
...
...
This diff is collapsed.
Click to expand it.
r.scripts/sc_QuSAGE_UKSubClust.R
deleted
100644 → 0
+
0
−
523
View file @
cf73641c
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