diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index e63f6c6..0c1530a 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -60,13 +60,6 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - - name: Cache R packages - uses: actions/cache@v4 - with: - path: /home/runner/work/_temp/Library - key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}- - - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck diff --git a/.github/workflows/vignette.yml b/.github/workflows/vignette.yml index 0702e2b..7cab28e 100644 --- a/.github/workflows/vignette.yml +++ b/.github/workflows/vignette.yml @@ -79,13 +79,6 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - - name: Cache R packages - uses: actions/cache@v4 - with: - path: /home/runner/work/_temp/Library - key: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ matrix.config.os }}-biocversion-${{ steps.BIOC.outputs.version}}-r-${{ steps.R.outputs.version}}- - - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: pkgdown diff --git a/DESCRIPTION b/DESCRIPTION index 07f6dfc..7adc631 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dandelionR Title: Single-cell Immune Repertoire Trajectory Analysis in R -Version: 0.99.3 +Version: 0.99.4 Authors@R: c(person(given="Jiawei", family="Yu", email = "jiawei.yu@uq.edu.au", role = c("aut"), comment = c(ORCID = "0009-0005-9170-7881")), person(given="Nicholas", family="Borcherding", email = "borcherding@wustl.edu", role = c("aut"), comment = c(ORCID = "0000-0003-1427-6342")), diff --git a/vignettes/vignette_from_scRepertoire.Rmd b/vignettes/vignette_from_scRepertoire.Rmd index 8cf8f51..45d4229 100644 --- a/vignettes/vignette_from_scRepertoire.Rmd +++ b/vignettes/vignette_from_scRepertoire.Rmd @@ -78,6 +78,10 @@ data(demo_sce) data(demo_airr) ``` +We will set the seed so that the plots and results are consistent. +```{r} +set.seed(123) +``` ### Use `scRepertoire` to load the VDJ data For the trajectory analysis work here, we are focusing on the main productive TCR chains. Therefore we will flag `filterMulti = TRUE`, which will keep the selection of the 2 corresponding chains with the highest expression for a single barcode. For more details, refer to `scRepertoire`'s [documentation](https://www.borch.dev/uploads/screpertoire/reference/combinetcr). @@ -121,6 +125,11 @@ sce <- setupVdjPseudobulk(sce, ) ``` +The main output of this function is a `SingleCellExperiment` object with the relevant VDJ information appended to the `colData`, particularly the columns with the `_main` suffix e.g. `v_call_abT_VJ_main`, `j_call_abT_VJ_main` etc. +```{r} +head(colData(sce)) +``` + Visualise the UMAP of the filtered data. ```{r} plotUMAP(sce, color_by = "anno_lvl_2_final_clean") @@ -152,12 +161,16 @@ plotUMAP(milo_object, color_by = "anno_lvl_2_final_clean", dimred = "UMAP_knngra Next, we will construct the pseudobulked VDJ feature space using the neighbourhood graph constructed above. We will also run PCA on the pseudobulked VDJ feature space. ```{r} pb.milo <- vdjPseudobulk(milo_object, mode_option = "abT", col_to_take = "anno_lvl_2_final_clean") +``` -pb.milo <- runPCA(pb.milo, assay.type = "Feature_space", ncomponents = 20) +Inspect the newly created `pb.milo` object. +```{r} +pb.milo ``` -We can visualise the PCA of the pseudobulked VDJ feature space. +We can compute and visualise the PCA of the pseudobulked VDJ feature space. ```{r} +pb.milo <- runPCA(pb.milo, assay.type = "Feature_space", ncomponents = 20) plotPCA(pb.milo, color_by = "anno_lvl_2_final_clean") ``` @@ -183,7 +196,7 @@ library(destiny) dm <- DiffusionMap(t(pca), n_pcs = 10, n_eigs = 10) ``` -### Compute diffussion pseudotime on diffusion map +### Compute diffusion pseudotime on diffusion map ```{r} dif.pse <- DPT(dm, tips = c(root, branch.tips), w_width = 0.1) ``` @@ -199,7 +212,7 @@ plotPCA(pb.milo, color_by = "pseudotime") + scale_colour_gradientn(colours = pal ``` ### Markov chain construction on the pseudobulk VDJ feature space - +This step will compute the Markov chain probabilities on the pseudobulk VDJ feature space. It will return the branch probabilities in the `colData` and the column name corresponds to the branch tips defined earlier. ```{r} pb.milo <- markovProbability( milo = pb.milo, @@ -211,6 +224,11 @@ pb.milo <- markovProbability( ) ``` +Inspect the `pb.milo` object to see the newly added columns. +```{r} +head(colData(pb.milo)) +``` + ### Visualising branch probabilities With the Markov chain probabilities computed, we can visualise the branch probabilities towards CD4+ or CD8+ T-cell fate on the PCA plot.