Skip to content

Commit be094af

Browse files
committed
Merge branch 'main' into bioconductor_review_update1
2 parents 3bdc2b1 + f631cc6 commit be094af

7 files changed

Lines changed: 72 additions & 66 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: SuperCellCyto
22
Title: SuperCell For Cytometry Data
3-
Version: 0.99.0
3+
Version: 0.99.1
44
Authors@R: c(
55
person("Givanna", "Putri", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7399-8014"), email = "givanna.h@gmail.com"),
66
person("George", "Howitt", role = "aut"),

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# SuperCellCyto 0.99.1
2+
3+
* Changed `paste` to `sprintf` for warning messages.
4+
* Moved example data to `inst/extdata` and update vignettes.
5+
* Add chunk labels to vignettes.
6+
17
# SuperCellCyto 0.99.0
28

39
## Major changes

vignettes/SuperCellCyto.Rmd

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
1616
)
1717
```
1818

19-
```{r setup, echo=FALSE, message=FALSE}
19+
```{r load_packages, echo=FALSE, message=FALSE}
2020
library(SuperCellCyto)
2121
library(parallel)
2222
library(BiocParallel)
@@ -97,7 +97,7 @@ with each sample containing 10,000 cells.
9797
Hence in total, we will have a toy dataset containing 15 markers and
9898
30,000 cells.
9999

100-
```{r}
100+
```{r simulate_data}
101101
n_markers <- 15
102102
n_samples <- 3
103103
dat <- simCytoData(nmarkers = n_markers, ncells = rep(10000, n_samples))
@@ -107,7 +107,7 @@ head(dat)
107107
For our toy dataset, we will transform our data using arcsinh transformation.
108108
We will use the base R `asinh` function to do this:
109109

110-
```{r}
110+
```{r arcsinh_transformation}
111111
# Specify which columns are the markers to transform
112112
marker_cols <- paste0("Marker_", seq_len(n_markers))
113113
# The co-factor for arc-sinh
@@ -130,7 +130,7 @@ We will also create a column *Cell_id_dummy* which uniquely identify each cell.
130130
It will have values such as `Cell_1, Cell_2,` all the way until `Cell_x`
131131
where x is the number of cells in the dataset.
132132

133-
```{r}
133+
```{r create_cell_id}
134134
dat$Cell_id_dummy <- paste0("Cell_", seq_len(nrow(dat)))
135135
head(dat$Cell_id_dummy, n = 10)
136136
```
@@ -139,13 +139,13 @@ By default, the `simCytoData` function will generate cells for multiple samples,
139139
and that the resulting `data.table` object will already have a column
140140
called *Sample* that denotes the sample the cells come from.
141141

142-
```{r}
142+
```{r check_sample_col}
143143
unique(dat$Sample)
144144
```
145145

146146
Let's take note of the sample and cell id column for later.
147147

148-
```{r}
148+
```{r set_colnames}
149149
sample_col <- "Sample"
150150
cell_id_col <- "Cell_id_dummy"
151151
```
@@ -167,7 +167,7 @@ your data, then make sure you specify them in a vector that you later pass to
167167
For this tutorial, we will use all the arcsinh transformed markers in the
168168
toy data.
169169

170-
```{r}
170+
```{r run_supercellcyto}
171171
supercells <- runSuperCellCyto(
172172
dt = dat,
173173
markers = marker_cols_asinh,
@@ -178,13 +178,13 @@ supercells <- runSuperCellCyto(
178178

179179
Let's dig deeper into the object it created:
180180

181-
```{r}
181+
```{r check_supercells_class}
182182
class(supercells)
183183
```
184184

185185
It is a list containing 3 elements:
186186

187-
```{r}
187+
```{r check_supercells_names}
188188
names(supercells)
189189
```
190190

@@ -207,7 +207,7 @@ supercell.
207207
These are calculated by taking the average of the marker expression of
208208
all the cells contained within a supercell.
209209

210-
```{r}
210+
```{r show_supercell_expr_matrix}
211211
head(supercells$supercell_expression_matrix)
212212
```
213213

@@ -224,7 +224,7 @@ variable).
224224

225225
Let's have a look at `SuperCellId`:
226226

227-
```{r}
227+
```{r show_supercell_ids}
228228
head(unique(supercells$supercell_expression_matrix$SuperCellId))
229229
```
230230

@@ -234,7 +234,7 @@ a sample) used to uniquely identify each supercell in a sample.
234234
Notably, you may encounter this (`SuperCell_1`, `SuperCell_2`) being repeated
235235
across different samples, e.g.,
236236

237-
```{r}
237+
```{r show_supercell_1_ids}
238238
supercell_ids <- unique(supercells$supercell_expression_matrix$SuperCellId)
239239
supercell_ids[grep("SuperCell_1_", supercell_ids)]
240240
```
@@ -253,7 +253,7 @@ This aids in differentiating the supercells in different samples.
253253
`supercell_cell_map` maps each cell in our dataset to the supercell it
254254
belongs to.
255255

256-
```{r}
256+
```{r show_supercell_cell_map}
257257
head(supercells$supercell_cell_map)
258258
```
259259

@@ -280,7 +280,7 @@ As each sample will be processed by a parallel job, we don't want a job that
280280
processs large sample to also be assigned other smaller samples if possible.
281281
If you want to know more how this feature works, please refer to our manuscript.
282282

283-
```{r}
283+
```{r run_supercellcyto_parallel}
284284
supercell_par <- runSuperCellCyto(
285285
dt = dat,
286286
markers = marker_cols_asinh,
@@ -343,7 +343,7 @@ toy dataset, we will regenerate the supercells using gamma of 10 and 50.
343343
The function to do this is `recomputeSupercells`.
344344
We will store the output in a list, one element per gamma value.
345345

346-
```{r}
346+
```{r recompute_supercells}
347347
addt_gamma_vals <- c(10, 50)
348348
supercells_addt_gamma <- lapply(addt_gamma_vals, function(gam) {
349349
recomputeSupercells(
@@ -361,7 +361,7 @@ We should end up with a list containing 2 elements.
361361
The 1st element contains supercells generated using gamma = 10,
362362
and the 2nd contains supercells generated using gamma = 50.
363363

364-
```{r}
364+
```{r show_supercells_gamma10}
365365
supercells_addt_gamma[[1]]
366366
```
367367

@@ -377,7 +377,7 @@ Compared to the previous run where gamma was set to 20, we should get more
377377
supercells for gamma = 10, and less for gamma = 50.
378378
Let's see if that's the case.
379379

380-
```{r}
380+
```{r count_supercells}
381381
n_supercells_gamma20 <- nrow(supercells$supercell_expression_matrix)
382382
n_supercells_gamma10 <- nrow(
383383
supercells_addt_gamma[[1]]$supercell_expression_matrix
@@ -387,11 +387,11 @@ n_supercells_gamma50 <- nrow(
387387
)
388388
```
389389

390-
```{r}
390+
```{r gamma10_gt_gamma20}
391391
n_supercells_gamma10 > n_supercells_gamma20
392392
```
393393

394-
```{r}
394+
```{r gamma50_lt_gamma20}
395395
n_supercells_gamma50 < n_supercells_gamma20
396396
```
397397

@@ -405,7 +405,7 @@ and run `runSuperCellCyto`
405405
function on each of them with different `gam` parameter value.
406406
Something like the following:
407407

408-
```{r}
408+
```{r diff_gamma_per_sample}
409409
n_markers <- 10
410410
dat <- simCytoData(nmarkers = n_markers)
411411
markers_col <- paste0("Marker_", seq_len(n_markers))
@@ -433,7 +433,7 @@ supercells_diff_gam <- lapply(seq_len(length(samples)), function(i) {
433433
Subsequently, to extract and combine the `supercell_expression_matrix` and
434434
`supercell_cell_map`, we will need to use `rbind`:
435435

436-
```{r}
436+
```{r combine_supercell_results}
437437
supercell_expression_matrix <- do.call(
438438
"rbind", lapply(
439439
supercells_diff_gam, function(x) x[["supercell_expression_matrix"]]
@@ -447,14 +447,14 @@ supercell_cell_map <- do.call(
447447
)
448448
```
449449

450-
```{r}
450+
```{r show_combined_expr_matrix}
451451
rbind(
452452
head(supercell_expression_matrix, n = 3),
453453
tail(supercell_expression_matrix, n = 3)
454454
)
455455
```
456456

457-
```{r}
457+
```{r show_combined_cell_map}
458458
rbind(head(supercell_cell_map, n = 3), tail(supercell_cell_map, n = 3))
459459
```
460460

@@ -499,6 +499,6 @@ load the relevant output saved using the qs package and the relevant data
499499
`recomputeSupercells` function.
500500

501501
## Session information
502-
```{r}
502+
```{r session_info}
503503
sessionInfo()
504504
```

vignettes/how_to_prepare_data.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ vignette: >
99
%\VignetteEncoding{UTF-8}
1010
---
1111

12-
```{r, include = FALSE}
12+
```{r setup, include = FALSE}
1313
knitr::opts_chunk$set(
1414
collapse = TRUE,
1515
comment = "#>"
@@ -59,7 +59,7 @@ For Oetjen_bcell data, we used the following gating strategy post compensation:
5959
The following is the resulting single live cells manually gated for the
6060
`Oetjen_bcell` data.
6161

62-
```{r}
62+
```{r add_fig}
6363
knitr::include_graphics(
6464
"figures/oetjen_bcell_single_live_cells.png",
6565
error = FALSE
@@ -134,7 +134,7 @@ For this example, let's load two CSV files containing subsampled data from the
134134
Each file represents a sample (H1 and H2), with the sample name appended
135135
to the file name:
136136

137-
```{r}
137+
```{r load_csv_data}
138138
library(data.table)
139139
140140
csv_files <- system.file(
@@ -192,7 +192,7 @@ Let's load two small FCS files for the Anti-PD1 data from
192192
[FlowRepository](
193193
http://flowrepository.org/public_experiment_representations/1124).
194194

195-
```{r}
195+
```{r load_fcs_data}
196196
library(flowCore)
197197
library(data.table)
198198
@@ -238,7 +238,7 @@ them into our `data.table` object.
238238
We will also to create a new column `cell_id` which gives each cell a
239239
unique id such as `Cell_1`, `Cell_2`, etc.
240240

241-
```{r}
241+
```{r add_sample_and_cellid}
242242
sample_info <- data.table(
243243
sample = c("patient9", "patient15"),
244244
file_name = c(
@@ -278,7 +278,7 @@ First, we need to select the markers to be transformed.
278278
Usually, all markers should be transformed for SuperCellCyto.
279279
However, you can choose to exclude specific markers if needed:
280280

281-
```{r}
281+
```{r define_markers}
282282
markers <- c(
283283
"209Bi_CD11b", "162Dy_CD11c", "163Dy_CD7", "166Er_CD209", "167Er_CD38",
284284
"151Eu_CD123", "153Eu_CD62L", "152Gd_CD66b", "154Gd_ICAM-1", "155Gd_CD1c",
@@ -292,7 +292,7 @@ markers <- c(
292292
For transformation, we'll use a cofactor of 5 and apply the
293293
arcsinh transformation.
294294

295-
```{r}
295+
```{r arcsinh_transformation}
296296
new_cols <- paste0(markers, "_asinh")
297297
cf <- 5
298298
dat[, (new_cols) := lapply(.SD, function(x) asinh(x / cf)), .SDcols = markers]
@@ -312,7 +312,7 @@ Please refer to
312312
for detailed instructions.
313313

314314
## Session information
315-
```{r}
315+
```{r session_info}
316316
sessionInfo()
317317
```
318318

0 commit comments

Comments
 (0)