Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace equals signs #47

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion episodes/cell_type_annotation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions episodes/eda_qc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand All @@ -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.

<!-- TODO: cite official 10x CellRanger docs -->
:::

:::: challenge
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion episodes/hca.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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) &
Expand Down
6 changes: 3 additions & 3 deletions episodes/intro-sce.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -260,7 +260,7 @@ sce <- WTChimeraData(samples = 5)

sce6 <- WTChimeraData(samples = 6)

combined_sce = cbind(sce, sce6)
combined_sce <- cbind(sce, sce6)

combined_sce
```
Expand Down
12 changes: 6 additions & 6 deletions episodes/large_data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)) +
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down
Loading