Skip to content

Commit 8b323e4

Browse files
committed
Running Overview and Anno Markdown
1 parent db487d6 commit 8b323e4

20 files changed

Lines changed: 45 additions & 39 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: SCWorkflow
22
Title: SCWorkflow from NIDAP
33
Version: 1.0.2
4-
Authors@R: c(person("Maggie", "Cam", email = "maggie.cam@nih.gov", role = "aut", comment = c(ORCID = "0000-0001-8190-9766")),
4+
Authors@R: c(person("Maggie", "Cam", email = "maggie.cam@nih.gov", role = "aut", comment = c(ORCID = "0000-0001-8190-9766")),
55
person("Thomas", "Meyer", email = "thomas.meyer@nih.gov", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7185-5597")),
66
person("Jing", "Bian", email = "bianjh@nih.gov", role = "aut", comment = c(ORCID = "0000-0001-7109-716X")),
77
person("Alexandra", "Michalowski", email = "michaloa@mail.nih.gov", role = "aut", comment = c(ORCID = "0000-0001-9259-6101")),
@@ -18,7 +18,7 @@ Description: A set of functions for analyzing single-cell RNA-seq data using the
1818
License: MIT
1919
Encoding: UTF-8
2020
Roxygen: list(markdown = TRUE)
21-
RoxygenNote: 7.2.3
21+
RoxygenNote: 7.3.3
2222
Suggests:
2323
testthat (>= 3.0.0)
2424
Depends:

NAMESPACE

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ importFrom(dplyr,rename)
8383
importFrom(dplyr,row_number)
8484
importFrom(dplyr,select)
8585
importFrom(dplyr,summarise)
86-
importFrom(ggExtra,aes)
87-
importFrom(ggExtra,coord_fixed)
88-
importFrom(ggExtra,geom_hline)
8986
importFrom(ggExtra,ggMarginal)
90-
importFrom(ggExtra,ggtitle)
91-
importFrom(ggExtra,scale_color_identity)
92-
importFrom(ggExtra,theme_bw)
9387
importFrom(ggplot2,aes)
9488
importFrom(ggplot2,geom_point)
9589
importFrom(ggplot2,geom_vline)

vignettes/SCWorkflow-Annotations.Rmd

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ library(dplyr)
2121
library(ggplot2)
2222
library(tibble)
2323
24-
Comb_SO=readRDS("./images/CN_SO.rds")
24+
Comb_SO=list()
25+
Comb_SO$object=readRDS("./images/CN_SO.rds")
26+
evalChunk=F
27+
28+
2529
```
2630

2731

@@ -32,7 +36,7 @@ This function automates cell type annotation in single-cell RNA sequencing data
3236
SingleR is an automatic annotation method for single-cell RNA sequencing data that uses a given reference dataset of samples (single-cell or bulk) with known labels to label new cells from a test dataset based on similarity to the reference. Two mouse reference datasets (MouseRNAseqData and ImmGenData) and two human reference datasets (HumanPrimaryCellAtlasData and BlueprintEncodeData) from CellDex R package [2] are currently available.
3337

3438

35-
```{r,eval=F}
39+
```{r,eval=evalChunk}
3640
Anno_SO=annotateCellTypes(object=Comb_SO$object,
3741
species = "Mouse",
3842
reduction.type = "umap",
@@ -43,7 +47,7 @@ Anno_SO=annotateCellTypes(object=Comb_SO$object,
4347
```
4448

4549

46-
```{r,echo=F,eval=F}
50+
```{r,echo=F,eval=evalChunk}
4751
saveRDS(Anno_SO, file="./images/Anno_SO.rds")
4852
4953
ggsave(Anno_SO$p1, filename = "./images/Anno1.png", width = 10, height = 10)
@@ -67,7 +71,7 @@ CellType_Anno_Table=read.csv("PerCell_Metadata.csv")
6771
6872
```
6973

70-
```{r,eval=T,echo=F}
74+
```{r,eval=evalChunk,echo=F}
7175
Anno_SO=readRDS("./images/Anno_SO.rds")
7276
7377
@@ -228,7 +232,7 @@ This function enables users to visualize the association between two selected ge
228232

229233
Furthermore, the tool allows for the application of filters to the data, setting thresholds, and providing annotations to notify users if cells meet the established thresholds. The visualization can be improved by omitting extreme values. The tool also facilitates the creation of a heatmap to represent the density distribution of cells and exhibit the raw gene/protein expression values.
230234

231-
```{r,eval=F,echo=T,results='hide'}
235+
```{r,eval=evalChunk,echo=T,results='hide'}
232236
grep('Cd4',rownames(Anno_SO$object@assays$RNA),ignore.case = T,value=T)
233237
234238
DLAnno_SO=dualLabeling(object = Anno_SO$object,
@@ -261,7 +265,7 @@ plot(DLAnno_SO$plot_densityHM)
261265
plot(DLAnno_SO$plot_umap)
262266
```
263267

264-
```{r,echo=F,eval=F}
268+
```{r,echo=F,eval=evalChunk}
265269
png(filename="./images/DL1.png")
266270
plot(DLAnno_SO$plot_densityHM)
267271
dev.off()
@@ -289,41 +293,43 @@ The output of this function is a detailed figure showing the activity of chosen
289293
Marker_Table <- read.csv("Marker_Table_demo.csv")
290294
```
291295

292-
```{r,eval=T,echo=F}
296+
```{r,eval=evalChunk,echo=F}
293297
Marker_Table_demo <- read.csv("../tests/testthat/fixtures/Marker_Table_demo.csv")
294298
Marker_Table_demo%>%head()%>%
295299
knitr::kable()
296300
297301
Marker_Table=Marker_Table_demo[1:4,]
298302
```
299303

300-
```{r,eval=F,echo=T,results='hide'}
304+
```{r,eval=evalChunk,echo=T,results='hide',fig.width=10,fig.asp=.9}
301305
302-
FigOut=colorByMarkerTable(object=Anno_SO$object,
306+
colorByMarkerTable(object=Anno_SO$object,
303307
samples.subset=c("PBS","ENT","NHSIL12", "Combo","CD8dep" ),
304308
samples.to.display=c("PBS","ENT","NHSIL12", "Combo","CD8dep" ),
305309
marker.table=Marker_Table,
306-
cells.of.interest=c("Macrophages","M1","M2" ),
310+
cells.of.interest=c("Neutrophils","Macrophages","CD8_T" ),
307311
protein.presence = FALSE,
308312
assay = "SCT",
309313
reduction.type = "umap",
310314
point.transparency = 0.5,
311315
point.shape = 16,
312316
cite.seq = FALSE
313317
)
314-
plot(FigOut)
318+
315319
316320
```
317321

318-
```{r,echo=F,eval=F}
322+
```{r,echo=F,eval=evalChunk}
319323
png(filename="./images/CBM1.png",width=1000,height=700)
320-
plot(FigOut)
324+
FigOut
321325
dev.off()
322326
323327
```
324328

325-
![](./images/CBM1.png){width=600}
326-
329+
<!-- ![](./images/CBM1.png){width=400} -->
330+
<p align="center" width="100%">
331+
<img width="66%" src="./images/CBM1.png">
332+
</p>
327333

328334

329335
## Module Score Cell Classification
@@ -334,23 +340,29 @@ This function can be used to quantify the expression of marker sets in each indi
334340

335341
This function aids in identifying cell types based on average gene expression. It uses a feature of the Seurat software known as the AddModuleScore function. This function calculates the gene expression of specific sets and records them within a designated area of the Seurat object. The program then forecasts cell identities by comparing these recorded scores across various gene sets. You have the ability to adjust the identification process by designating cutoff points for a bimodal distribution in a parameter known as manual threshold. Any thresholds below this cutoff will not be considered during the identification process.
336342

337-
**Inputs:** The program takes several inputs. These include the single-cell RNA sequencing (scRNA-seq) object, a selection of samples for analysis, a table of gene markers for different cell types, and optionally, a hierarchical table for directing the order of cell classification.
338-
**Data Preparation:** The program prepares the scRNA-seq object, assigns names to the samples, and selects data based on your specified samples.
339-
**Module Score Calculation:** The program calculates module scores, a measure of gene set activity or expression [1], for each cell type based on your provided marker table.
343+
**Inputs:** The program takes several inputs. These include the single-cell RNA sequencing (scRNA-seq) object, a selection of samples for analysis, a table of gene markers for different cell types, and optionally, a hierarchical table for directing the order of cell classification.
344+
345+
**Data Preparation:** The program prepares the scRNA-seq object, assigns names to the samples, and selects data based on your specified samples.
346+
347+
**Module Score Calculation:** The program calculates module scores, a measure of gene set activity or expression [1], for each cell type based on your provided marker table.
348+
340349
**Visualization:** Density distribution plots and colored reduction plots will be generated to help you visualize the module scores, their relationship with cell types, and sample identities.
341-
**Thresholding:** Users can select threshold values to aid in the classification of cells. Cells with scores below your designated threshold will be labeled as "unknown".
350+
351+
**Thresholding:** Users can select threshold values to aid in the classification of cells. Cells with scores below your designated threshold will be labeled as "unknown".
352+
342353
Subclass Identification: If desired, the program can identify subclasses within cell types by further analyzing subpopulations.
343-
**Updating Cell Type Labels:** The program appends a "Likely_CellType" column to the metadata of the scRNA-seq object, based on the results of the module score analysis.
354+
**Updating Cell Type Labels:** The program appends a "Likely_CellType" column to the metadata of the scRNA-seq object, based on the results of the module score analysis.
355+
344356
**Output:** An updated scRNA-seq object with new cell type labels.
345357

346-
```{r,eval=F}
358+
```{r,eval=evalChunk}
347359
348360
MS_object=modScore(object=Anno_SO$object,
349-
marker.table=Marker_Table[,c("Macrophages","M1","M2" )],
350-
ms.threshold=c("Macrophages .40","M1 .25","M2 .14"),
351-
use_assay = "SCT",
352-
general.class=c("Macrophages"),
353-
lvl.vec = c('Macrophages-M1','Macrophages-M2'),
361+
marker.table=Marker_Table,
362+
use_columns = c("Neutrophils","Macrophages","CD8_T" ),
363+
ms_threshold=c("Neutrophils .25","Macrophages .40","CD8_T .14"),
364+
general.class=c("Neutrophils","Macrophages","CD8_T"),
365+
multi.lvl = FALSE,
354366
reduction = "umap",
355367
nbins = 10,
356368
gradient.ft.size = 6,
@@ -361,7 +373,7 @@ MS_object=modScore(object=Anno_SO$object,
361373
```
362374
![](./images/MS1.png){width=600}
363375

364-
![](./images/MS2.png){width=300} ![](./images/MS3.png){width=300}
376+
<!-- ![](./images/MS2.png){width=300} ![](./images/MS3.png){width=300} -->
365377

366378

367379

@@ -377,9 +389,10 @@ This function creates a dot plot visualization of cell types by metadata categor
377389
It also generates a dot plot using Seurat's Dotplot function [3], providing a visual representation of the percentage of various cell types within each cluster. Typically, a cluster can be more distinctively named by the predominant cell type as seen in the dotplot. The plot's order can be customized for the clusters and cell types. If no specific order is provided, the function uses a default order.
378390
An optional parameter allows the user to make the plot interactive. The function returns the updated Seurat object and the plot.
379391

380-
```{r,eval=F}
392+
```{r,eval=evalChunk}
381393
382394
RNC_object=nameClusters(object=Anno_SO$object,
395+
cluster.identities.table=
383396
cluster.numbers= c(0,1,2,3,4,5,6,7),
384397
cluster.names=c("Pop0", "Pop1", "Pop2", "Pop3","Pop4", "Pop5", "Pop6", "Pop7"),
385398
cluster.column ="SCT_snn_res.0.2",
@@ -421,13 +434,12 @@ In addition to the plot, the function provides the tabular format of the dot plo
421434
This function can be useful for exploratory data analysis and visualizing the differences in gene expression across different conditions or groups of cells.
422435

423436

424-
```{r,eval=F}
437+
```{r,eval=evalChunk}
425438
426439
FigOut=dotPlotMet(object=Anno_SO$object,
427440
metadata="orig.ident",
428441
cells=c("PBS","ENT","NHSIL12", "Combo","CD8dep" ),
429442
markers=Marker_Table$Macrophages,
430-
use_assay = "SCT",
431443
plot.reverse = FALSE,
432444
cell.reverse.sort = FALSE,
433445
dot.color = "darkblue"

vignettes/SCWorkflow-Overview.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ library(data.table)
2020
library(dplyr)
2121
library(ggplot2)
2222
23-
evalChunk=T
23+
evalChunk=F
2424
```
2525

2626

vignettes/images/Anno1.png

55.8 KB
Loading

vignettes/images/Anno2.png

67.8 KB
Loading

vignettes/images/CBM1.png

-31.6 KB
Loading

vignettes/images/CN1.png

94.1 KB
Loading

vignettes/images/CN2.png

-64.7 KB
Loading

vignettes/images/DL1.png

1.59 KB
Loading

0 commit comments

Comments
 (0)