Skip to content

Commit 7b75b95

Browse files
committed
...
Merge branch 'main' of https://github.com/jn-goe/gruffi into main Conflicts: R/gruffi.R R/gruffi.optional.R man/StressUMAP.Rd
2 parents 11cc7c4 + 15a362f commit 7b75b95

12 files changed

+486
-299
lines changed

CITATION.cff

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cff-version: 1.2.0
22
title: Gruffi identifies and removes stressed cells from brain organoid single-cell datasets.
3-
version: v1.2.6
3+
version: v1.5.5
44
message: >-
55
If you use this software, please cite: https://doi.org/10.15252/embj.2022111118 "Gruffi: an algorithm for computational removal of stressed cells from brain organoid transcriptomic datasets"
66

DESCRIPTION

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: gruffi
22
Title: Gruffi identifies and removes stressed cells from brain organoid
33
single-cell datasets.
4-
Version: 1.2.6
4+
Version: 1.5.5
55
Authors@R:
66
person("First", "Last", , "first.last@example.com", role = c("aut", "cre"),
77
comment = c(ORCID = "YOUR-ORCID-ID"))
@@ -18,7 +18,7 @@ Depends:
1818
magrittr,
1919
MarkdownReports,
2020
Seurat,
21-
Stringendo
21+
Stringendo (>= 0.5.0)
2222
Imports:
2323
AnnotationDbi,
2424
biomaRt,
@@ -29,21 +29,23 @@ Imports:
2929
dplyr,
3030
ggExpress,
3131
ggplot2,
32-
htmlwidgets,
3332
IRanges,
34-
MarkdownHelpers,
33+
MarkdownHelpers (>= 1.0.1),
3534
Matrix,
3635
org.Hs.eg.db,
37-
raster,
38-
rgl,
3936
rlang,
4037
Seurat.utils,
4138
shiny,
42-
sm,
4339
stringr,
4440
tictoc,
4541
viridis
42+
Suggests:
43+
htmlwidgets,
44+
raster,
45+
rgl,
46+
sm,
47+
viridis
4648
Encoding: UTF-8
47-
Packaged: 2024-02-14 21:41:57.815611
49+
Packaged: 2024-03-04 10:20:40.271269
4850
Roxygen: list(markdown = TRUE)
4951
RoxygenNote: 7.3.1

FAQ.md

+5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ combined.obj <- CustomScoreEvaluation(obj = combined.obj, custom.score.name = 'S
5454
Finally continue with the Gruffi pipeline as normal, by calling the Shiny app. This extension of the Gruffi workflow is less tested, so if you find bugs / encounter an error, [please let us know](https://github.com/jn-goe/gruffi/issues).
5555

5656

57+
## 4. Does it work with Seurat v5+?
5758

59+
Yes, it should. Please raise an `issue` if you experience problems.
5860

61+
## 5. Does it install and run work with R v4.4.X?
5962

63+
Yes, it should. You may need to manually install `terra` and `rgl` dependencies.
64+
Please raise an `issue` if you experience problems.

Functions.md

+167-149
Large diffs are not rendered by default.

NAMESPACE

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export(StressUMAP)
3636
export(UMAP3Dcubes)
3737
importFrom(AnnotationDbi,Term)
3838
importFrom(AnnotationDbi,select)
39-
importFrom(CodeAndRoll2,as.numeric.wNames.character)
4039
importFrom(CodeAndRoll2,grepv)
4140
importFrom(CodeAndRoll2,matrix.fromNames)
4241
importFrom(CodeAndRoll2,sem)

README.md

+46-21
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ The Gruffi R package helps you (1) to identify stressed cells in single-cell RNA
99
`Gruffi` integrates into any `Seurat` analysis pipelione & it comes with a graphical user interface.
1010

1111

12+
13+
14+
## News
15+
16+
- `v1.5.*` is released, that fixes critical problems which arose with changes in dependencies and made the installation / pipeline break. Additionally it contains updates necessary to work with Seurat v5 objects.
17+
- Now it is more explicit that GO-annotation can either be obtained via `BioMart` or `AnnotationDbi`, which is helpful, as BioMart connection is not always working. For the same reason, it now allows the usage of alternative mirrors for BioMart (thanks to `@zuzkamat`).
18+
- Major consistency update in function names, see below.
19+
- Consistency update in variable names (in @misc and @meta.data), for the latter, this update is not backward compatible, meaning earlier results needs manual adjustments in those names to run. Recommended is to rerun the new version.
20+
- Major cleanup and of the codebase. Granule average scores are now stored as numeric rather than factor.
21+
22+
<u>*Added functionality*</u>
23+
24+
- `FindThresholdsAuto()` that is a shiny free version `FindThresholdsShiny()`, which allows an automated workflow without the need for graphical output (thanks to `@heyfl`). We still strongly recommend the shiny based workflow that enforces users to look at the results and intermediate steps instead of blidnly taking a TRUE / FALSE column.
25+
- New visualization functions, incuding:
26+
```r
27+
GrScoreUMAP(obj = combined.obj, colname = 'RNA_snn_res.6_cl.av_GO.0042063', miscname = 'thresh.stress.ident1')
28+
GrScoreHistogram(obj = combined.obj, colname = 'RNA_snn_res.6_cl.av_GO.0042063', miscname = 'thresh.stress.ident1')
29+
```
30+
- New helper functions that allow a simpler workflow and shorter codebase.
31+
32+
33+
34+
1235
## Installation
1336

1437
You can install dependencies from **CRAN, Bioconductor and GitHub** via **devtools**:
@@ -21,6 +44,8 @@ BiocManager::install("DOSE")
2144
BiocManager::install("org.Hs.eg.db")
2245
BiocManager::install("sparseMatrixStats")
2346
BiocManager::install("biomaRt")
47+
BiocManager::install("raster")
48+
BiocManager::install("rgl")
2449

2550

2651
# Install custom dependencies
@@ -63,12 +88,9 @@ If you want to store multiple UMAP's, you have to keep them in backup slot (in c
6388
Prepare GO-terms and gene-sets
6489

6590
```r
66-
ensembl <- biomaRt::useEnsembl("ensembl", dataset = "hsapiens_gene_ensembl")
67-
6891
go1 <- "GO:0006096" # Glycolysis
6992
go2 <- "GO:0034976" # ER-stress
7093
go3 <- "GO:0042063" # Gliogenesis, negative filtering
71-
7294
```
7395

7496
### 2. <u>Granule partitioning</u>
@@ -82,19 +104,19 @@ combined.obj <- AutoFindGranuleResolution(obj = combined.obj)
82104
The optimal resolution found is stored in:
83105

84106
```r
85-
granule.res.4.gruffi <- combined.obj@misc$gruffi$'optimal.granule.res'
107+
(granule.res.4.gruffi <- GetGruffiClusteringName(combined.obj)) # Recalled from @misc$gruffi$'optimal.granule.res.
86108
```
87109

88110
Some granules have too few cells, therfore their scoring is not robust statistically. Use `ReassignSmallClusters` to assign these cells to the nearest large-enough granule:
89111

90112
```R
91-
combined.obj <- ReassignSmallClusters(combined.obj, ident = granule.res.4.gruffi) # will be stored in meta data column as "seurat_clusters.reassigned"
113+
combined.obj <- ReassignSmallClusters(combined.obj, ident = granule.res.4.gruffi) # Will be stored in meta data column as "seurat_clusters.reassigned".
92114
````
93115

94116
Above, granules with <30 cells are cell-by-cell re-assigned to a neighboring granule (by default based on Euclidean distance between the mean of cell groups in 3dim UMAP space). The reassigned granules are suffixed as :
95117

96118
```r
97-
granule.res.4.gruffi <- paste0(granule.res.4.gruffi, '.reassigned')
119+
(granule.res.4.gruffi <- GetGruffiClusteringName(combined.obj))
98120
```
99121

100122

@@ -105,13 +127,13 @@ After finding the right granule resolution, first GO scores per cells, then aver
105127

106128
```R
107129
# Glycolytic process GO:0006096
108-
combined.obj <- GOscoreEvaluation(obj = combined.obj, GO_term = go1, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
130+
combined.obj <- AssignGranuleAverageScoresFromGOterm(obj = combined.obj, GO_term = go1, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
109131

110132
# ER stress GO:0034976
111-
combined.obj <- GOscoreEvaluation(obj = combined.obj, GO_term = go2, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
133+
combined.obj <- AssignGranuleAverageScoresFromGOterm(obj = combined.obj, GO_term = go2, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
112134

113135
# Gliogenesis GO:0042063
114-
combined.obj <- GOscoreEvaluation(obj = combined.obj, GO_term = go3, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
136+
combined.obj <- AssignGranuleAverageScoresFromGOterm(obj = combined.obj, GO_term = go3, save.UMAP = TRUE, new_GO_term_computation = T, clustering = granule.res.4.gruffi, plot.each.gene = F)
115137
```
116138

117139
These functions store the resulting scores in `combined.obj@meta.data`.
@@ -120,47 +142,50 @@ These functions store the resulting scores in `combined.obj@meta.data`.
120142

121143
### 4. <u>Stress filtering</u>
122144

123-
We will now call a Shiny Interface to auto-estimate and/or manually adjust the stress assignment threeholds via `Shiny.GO.thresh()`.
145+
We will now call a Shiny Interface to auto-estimate and/or manually adjust the stress assignment threeholds via `FindThresholdsShiny()`.
124146

125147
- The first 2 scores are for features to filter out (e.g.: cells with high ER stress and glycolysis),
126148
- and the last 2 scores are for features we want to keep (e.g.: cells with high gliogenesis).
127149

128150
Example code for filtering cells high in glycolytic process and ER stress but low in gliogenesis:
129151
```R
130152
# Create score names:
131-
(i1 <- Stringendo::kppu(granule.res.4.gruffi, 'cl.av', go1))
132-
(i2 <- Stringendo::kppu(granule.res.4.gruffi, 'cl.av', go2))
133-
(i3 <- Stringendo::kppu(granule.res.4.gruffi, 'cl.av', go3))
153+
(i1 <- ParseGruffiGranuleScoreName(goID = go1))
154+
(i2 <- ParseGruffiGranuleScoreName(goID = go2))
155+
(i3 <- ParseGruffiGranuleScoreName(goID = go3))
134156

135157
# Call Shiny app
136-
combined.obj <- Shiny.GO.thresh(obj = combined.obj,
158+
combined.obj <- FindThresholdsShiny(obj = combined.obj,
137159
stress.ident1 = i1,
138160
stress.ident2 = i2,
139-
notstress.ident3 = i3,
140-
plot.cluster.shiny = "orig.ident")
161+
notstress.ident3 = i3)
141162

142163
"Dont forget to click the button in the app: Save New Thresholds"
143164

144165
```
145-
The interfacte allows automatic estimation and manual adjustment of thresholds for stress scores:
166+
The interface allows automatic estimation and manual adjustment of thresholds for stress scores:
146167

147168
<img width="396" alt="ShinyInterface_Vel Org7 d90 ImpV" src="https://user-images.githubusercontent.com/72695751/156938645-d80fd987-36b1-46dd-b350-4fc26f62035e.png">
148169

149170

150171

151-
After pushing the **<u>Save new thresholds</u>** button in the Shiny graphical user interface, thresholds are saved in `combined.obj@misc$gruffi` and the stress assignment is stored as a new meta data column `is.Stressed`. Check results as:
172+
After pushing the **<u>Save new thresholds</u>** button in the Shiny graphical user interface, thresholds are saved in `combined.obj@misc$gruffi` and the stress assignment is stored as a new `@meta.data` column, `is.Stressed`. Check results with:
152173

174+
### 5. <u>Visualize results</u>
153175
```r
154-
Seurat.utils::clUMAP('is.Stressed', label =F)
176+
StressUMAP(combined.obj)
177+
StressBarplotPerCluster(combined.obj, group.by = GetClusteringRuns()[1])
178+
GrScoreHistogram(combined.obj, colname = i1, miscname = "thresh.stress.ident1")
179+
# and more
155180
```
156181

157-
### 5. <u>Remove stressed cells</u>
182+
### 6. <u>Remove stressed cells</u>
158183

159184
```R
160185
cellIDs.keep <- which_names(!combined.obj$'is.Stressed')
161186
subset.obj <- subset(x = combined.obj, cells = cellIDs.keep)
162187

163-
Seurat.utils::clUMAP('is.Stressed', label = F, obj = subset.obj)
188+
StressUMAP(combined.obj)
164189
```
165190

166191

dev/DESCRIPTION.bac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: gruffi
22
Title: Gruffi identifies and removes stressed cells from brain organoid
33
single-cell datasets.
4-
Version: 1.1.5
4+
Version: 1.5.2
55
Authors@R:
66
person("First", "Last", , "first.last@example.com", role = c("aut", "cre"),
77
comment = c(ORCID = "YOUR-ORCID-ID"))
@@ -44,6 +44,6 @@ Imports:
4444
tictoc,
4545
viridis
4646
Encoding: UTF-8
47-
Packaged: 2024-02-14 21:41:57.815611
47+
Packaged: 2024-02-27 14:10:48.517485
4848
Roxygen: list(markdown = TRUE)
4949
RoxygenNote: 7.2.3

0 commit comments

Comments
 (0)