Skip to content

Commit

Permalink
Update wSIR_workshop.Rmd
Browse files Browse the repository at this point in the history
There are various problems.  As set up now, data() will fail.  The package name must be consistent and have no underscores.  Some code does not seem to run in my tests.
  • Loading branch information
vjcitn authored and almahmoud committed Nov 7, 2024
1 parent 2740780 commit 1390682
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions vignettes/wSIR_workshop.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,21 @@ The expected timing of the workshop:
### Load packages

```{r}
library(wSIRBioCAsia2024)
library(BioCAsia2024wSIR) # use the same name, no underscores, as in DESCRIPTION
library(ggplot2)
library(vctrs)
library(wSIR)
library(magrittr)
library(dplyr) # for arrange
```

### Download data
### Acquire data

We will use spatial transcriptomics data for mouse embryos from https://www.nature.com/articles/s41587-021-01006-2 . We will examine how we can apply the wSIR functions to study this data. This dataset will illustrate how you can apply the package functions to your own data.

```{r}
data(embryos_data_red)
#data(embryos_data_red) # you don't have a data folder
load(system.file("extdata", "embryos_data_red.RData", package="BioCAsia2024wSIR"))
## files this downloads:
# exprs1
Expand Down Expand Up @@ -289,7 +291,7 @@ We recommend you don't adjust `nrep` or `varThreshold`, as this can make it take
```{r}
subsetted = 0.2 # Change this to specify the proportion of the data you want to use for this exploration
rsample <- sample(c(TRUE, FALSE), size = n3, replace = TRUE, prob = c(subsetted, 1-subsetted))
# FIXME
EWP_object <- exploreWSIRParams(exprs = exprs3[rsample,],
coords = coords3[rsample,],
nrep = 3, # This function computes a random train/test split of the data nrep times
Expand Down Expand Up @@ -447,7 +449,8 @@ Note that for this workshop, we will not actually compute the Tangram predicted
Below loads in 7 matrices, all of dimension n1 by 2, containing the predicted coordinates using as inputs: PCA, PLS, SIR, wSIR, LDA, counts and logcounts. The file names are of the form `pred_pca_em1`, in that case for the predicted coordinates of embryo 1 using the PCA low-dimensional embedding as the Tangram input. We also include the predicted coordinates using just counts or LogCounts as the inputs (without any dimension reduction applied) as those are the default inputs for Tangram.

```{r}
data(em1_tangram_preds_red) # This loads a list (not vector) of predicted coordinates into your environment, named pred_em1_tangram_red
#data(em1_tangram_preds_red) # This loads a list (not vector) of predicted coordinates into your environment, named pred_em1_tangram_red
load(system.file("extdata", "em1_tangram_preds_red.RData", package="BioCAsia2024wSIR"))
```

To evaluate, we will compute the distance correlation between the predicted and the actual coordinates, for the predicted coordinates from all dimension reduction methods. This is not part of the wSIR package, but should demonstrate the effectiveness of using wSIR as a dimension reduction tool to improve downstream analysis.
Expand Down

0 comments on commit 1390682

Please sign in to comment.