From a916d751a1167eb0c7e92915647b869a1b8bd328 Mon Sep 17 00:00:00 2001 From: Andrew Ghazi <6763470+andrewGhazi@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:44:29 -0400 Subject: [PATCH] replace equals signs --- episodes/cell_type_annotation.Rmd | 2 +- episodes/eda_qc.Rmd | 8 +++++--- episodes/hca.Rmd | 2 +- episodes/intro-sce.Rmd | 6 +++--- episodes/large_data.Rmd | 12 ++++++------ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/episodes/cell_type_annotation.Rmd b/episodes/cell_type_annotation.Rmd index e8cbaac..eed43b5 100644 --- a/episodes/cell_type_annotation.Rmd +++ b/episodes/cell_type_annotation.Rmd @@ -650,7 +650,7 @@ Use `BiocParallel` and the `BPPARAM` argument! This example will set it to use f library(BiocParallel) -my_bpparam = MulticoreParam(workers = 4) +my_bpparam <- MulticoreParam(workers = 4) res2 <- SingleR(test = sce.mat, ref = ref.mat, diff --git a/episodes/eda_qc.Rmd b/episodes/eda_qc.Rmd index 6c9cb5c..2d9851a 100644 --- a/episodes/eda_qc.Rmd +++ b/episodes/eda_qc.Rmd @@ -72,8 +72,8 @@ bcrank <- barcodeRanks(counts(sce)) # Only showing unique points for plotting speed. uniq <- !duplicated(bcrank$rank) -line_df = data.frame(cutoff = names(metadata(bcrank)), - value = unlist(metadata(bcrank))) +line_df <- data.frame(cutoff = names(metadata(bcrank)), + value = unlist(metadata(bcrank))) ggplot(bcrank[uniq,], aes(rank, total)) + geom_point() + @@ -92,6 +92,8 @@ A simple approach would be to apply a threshold on the total count to only retai ::: callout Depending on your data source, identifying and discarding empty droplets may not be necessary. Some academic institutions have research cores dedicated to single cell work that perform the sample preparation and sequencing. Many of these cores will also perform empty droplet filtering and other initial QC steps. If the sequencing outputs were provided to you by someone else, make sure to communicate with them about what pre-processing steps have been performed, if any. + + ::: :::: challenge @@ -671,7 +673,7 @@ e.out <- emptyDrops(counts(sce)) sce <- sce[,which(e.out$FDR <= 0.001)] # Thankfully the data come with gene symbols, which we can use to identify mitochondrial genes: -is.mito = grepl("^MT-", rowData(sce)$Symbol) +is.mito <- grepl("^MT-", rowData(sce)$Symbol) # QC metrics ---- df <- perCellQCMetrics(sce, subsets = list(Mito = is.mito)) diff --git a/episodes/hca.Rmd b/episodes/hca.Rmd index a0487b3..3481d8b 100644 --- a/episodes/hca.Rmd +++ b/episodes/hca.Rmd @@ -179,7 +179,7 @@ data. For the sake of demonstration, we'll focus this small subset of samples: ```{r} -sample_subset = metadata |> +sample_subset <- metadata |> filter( ethnicity == "African" & grepl("10x", assay) & diff --git a/episodes/intro-sce.Rmd b/episodes/intro-sce.Rmd index 8ad25c8..7873ae8 100644 --- a/episodes/intro-sce.Rmd +++ b/episodes/intro-sce.Rmd @@ -234,9 +234,9 @@ The `SingleCellExperiment` constructor function can be used to create a new `Sin ::: solution ```{r} -mat = matrix(runif(30), ncol = 5) +mat <- matrix(runif(30), ncol = 5) -my_sce = SingleCellExperiment(assays = list(logcounts = mat)) +my_sce <- SingleCellExperiment(assays = list(logcounts = mat)) my_sce$my_col_info = runif(5) @@ -260,7 +260,7 @@ sce <- WTChimeraData(samples = 5) sce6 <- WTChimeraData(samples = 6) -combined_sce = cbind(sce, sce6) +combined_sce <- cbind(sce, sce6) combined_sce ``` diff --git a/episodes/large_data.Rmd b/episodes/large_data.Rmd index 6edf17e..4bc0ab1 100644 --- a/episodes/large_data.Rmd +++ b/episodes/large_data.Rmd @@ -388,8 +388,8 @@ reducedDim(r.out, "PCA") = -1 * reducedDim(r.out, "PCA") From there we can visualize the error with a histogram: ```{r} -error = reducedDim(r.out, "PCA")[,"PC1"] - - reducedDim(e.out, "PCA")[,"PC1"] +error <- reducedDim(r.out, "PCA")[,"PC1"] - + reducedDim(e.out, "PCA")[,"PC1"] data.frame(approx_error = error) |> ggplot(aes(approx_error)) + @@ -569,15 +569,15 @@ function for writing to HDF5 from the `r Biocpkg("HDF5Array")` package. ```{r} -wt_out = tempfile(fileext = ".h5") +wt_out <- tempfile(fileext = ".h5") -wt_counts = counts(WTChimeraData()) +wt_counts <- counts(WTChimeraData()) writeHDF5Array(wt_counts, name = "wt_counts", file = wt_out) -oom_wt = HDF5Array(wt_out, "wt_counts") +oom_wt <- HDF5Array(wt_out, "wt_counts") object.size(wt_counts) @@ -607,7 +607,7 @@ Use the function `system.time` to obtain the runtime of each job. ```{r eval=FALSE} -sce.brain = logNormCounts(sce.brain) +sce.brain <- logNormCounts(sce.brain) system.time({i.out <- runPCA(sce.brain, ncomponents = 20,