From 1d939c4c25996f672d7e08754a13116792e295e1 Mon Sep 17 00:00:00 2001 From: Andrew Ghazi <6763470+andrewGhazi@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:37:24 -0400 Subject: [PATCH] solns to end exercises --- episodes/intro-sce.Rmd | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/episodes/intro-sce.Rmd b/episodes/intro-sce.Rmd index f27c601..37be0b0 100644 --- a/episodes/intro-sce.Rmd +++ b/episodes/intro-sce.Rmd @@ -222,13 +222,37 @@ The `SingleCellExperiment` constructor function can be used to create a new `Sin ::::::::::::::::::::::: + +::: solution + +```{r} +mat = matrix(runif(30), ncol = 5) + +my_sce = SingleCellExperiment(assays = list(logcounts = mat)) + +my_sce$my_col_info = runif(5) + +my_sce +``` + +::: + ::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::: challenge #### Exercise 2 -Combining two objects: The `MouseGastrulationData` package contains several datasets. Download sample 6 of the chimera experiment by running `sce6 <- WTChimeraData(sample=6)`. Use the `cbind` function to combine the new data with the `sce` object created before. +Combining two objects: The `MouseGastrulationData` package contains several datasets. Download sample 6 of the chimera experiment by running `sce6 <- WTChimeraData(samples=6)`. Use the `cbind` function to combine the new data with the `sce` object created before. + +```{r message = FALSE, warning=FALSE} +sce <- WTChimeraData(samples = 5) +sce6 <- WTChimeraData(samples = 6) + +combined_sce = cbind(sce, sce6) +combined_sce +``` + :::::::::::::::::::::::::::::::::::::::::::::