Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into UTSouthwesternDSSR/no…
Browse files Browse the repository at this point in the history
…nETP
  • Loading branch information
UTSouthwesternDSSR committed Oct 31, 2024
2 parents 7bde7e5 + 8d9dd4c commit 9b36d48
Show file tree
Hide file tree
Showing 150 changed files with 49,845 additions and 6,220 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/docker_cell-type-wilms-tumor-14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ concurrency:
cancel-in-progress: true

on:
# pull_request:
# branches:
# - main
# paths:
# - "analyses/cell-type-wilms-tumor-14/Dockerfile"
# - "analyses/cell-type-wilms-tumor-14/.dockerignore"
# - "analyses/cell-type-wilms-tumor-14/renv.lock"
# - "analyses/cell-type-wilms-tumor-14/conda-lock.yml"
# push:
# branches:
# - main
# paths:
# - "analyses/cell-type-wilms-tumor-14/Dockerfile"
# - "analyses/cell-type-wilms-tumor-14/.dockerignore"
# - "analyses/cell-type-wilms-tumor-14/renv.lock"
# - "analyses/cell-type-wilms-tumor-14/conda-lock.yml"
pull_request:
branches:
- main
paths:
- "analyses/cell-type-wilms-tumor-14/Dockerfile"
- "analyses/cell-type-wilms-tumor-14/.dockerignore"
- "analyses/cell-type-wilms-tumor-14/renv.lock"
- "analyses/cell-type-wilms-tumor-14/conda-lock.yml"
push:
branches:
- main
paths:
- "analyses/cell-type-wilms-tumor-14/Dockerfile"
- "analyses/cell-type-wilms-tumor-14/.dockerignore"
- "analyses/cell-type-wilms-tumor-14/renv.lock"
- "analyses/cell-type-wilms-tumor-14/conda-lock.yml"
workflow_dispatch:
inputs:
push-ecr:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/run_cell-type-wilms-tumor-14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ jobs:
with:
working-directory: ${{ env.MODULE_PATH }}

- name: Initialize zellkonverter environment
run: |
cd ${MODULE_PATH}
Rscript -e "proc <- basilisk::basiliskStart(env = zellkonverter::zellkonverterAnnDataEnv(), testload = 'anndata'); basilisk::basiliskStop(proc)"
# Update this step as needed to download the desired data
- name: Download test data and results
run: |
Expand Down
113 changes: 113 additions & 0 deletions 00_run_workflow.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env Rscript

# USAGE:
# Rscript 00_run_workflow.R
#
# USAGE in CI:
# Rscript 00_run_workflow.R --testing

# Set up options ----------------------------------------------------------------

library(optparse)

option_list <- list(
make_option(
opt_str = c("--testing"),
type = "logical",
default = FALSE,
action = "store_true",
help = "Use this flag when running on test data"
)
)

opts <- parse_args(OptionParser(option_list = option_list))
running_ci <- opts$testing

# Run the Label transfer from two fetal references ------------------------------

# get list of samples in the library --------------------------------------------
root_dir <- rprojroot::find_root(rprojroot::is_git_root)
project_id <- "SCPCP000006"
sample_metadata_file <- file.path(root_dir, "data", "current", project_id, "single_cell_metadata.tsv")
metadata <- read.table(sample_metadata_file, sep = "\t", header = TRUE)

# set path to this module--------------------------------------------------------
module_base <- file.path(root_dir, "analyses", "cell-type-wilms-tumor-06")

# Download and create the fetal kidney reference (Stewart et al) ----------
system(command = glue::glue("Rscript ", file.path(module_base,"scripts", "download-and-create-fetal-kidney-ref.R")))

# We build the gene position file reference for infercnv ------------------------
system(command = glue::glue("Rscript ", file.path(module_base, "scripts", "06a_build-geneposition.R")))

# Characterize the two fetal references -----------------------------------------

# Characterize the fetal full reference (Cao et al.)
# To be done, next PR
notebook_template_dir <- file.path(module_base, "notebook_template")
notebook_output_dir <- file.path(module_base, "notebook")
# Characterize the fetal kidney reference (Stewart et al.)
rmarkdown::render(input = file.path(notebook_template_dir, "00b_characterize_fetal_kidney_reference_Stewart.Rmd"),
output_format = "html_document",
output_file = "00b_characterization_fetal_kidney_reference_Stewart.html",
output_dir = file.path(notebook_output_dir, "00-reference"))


# Run the workflow for (all) samples in the project -----------------------------
for (sample_id in metadata$scpca_sample_id) {

# create a directory to save the pre-processed and labeled `Seurat` objects
dir.create(file.path(module_base, "results", sample_id), showWarnings = FALSE)
# create a directory to save the notebooks
dir.create(file.path(module_base, "notebook", sample_id), showWarnings = FALSE)

# Pre-process the data - `Seurat` workflow
rmarkdown::render(input = file.path(notebook_template_dir, "01_seurat-processing.Rmd"),
params = list(scpca_project_id = project_id, sample_id = sample_id),
output_format = "html_document",
output_file = paste0("01_seurat_processing_", sample_id, ".html"),
output_dir = file.path(notebook_output_dir, sample_id))

if (!running_ci) {
# Label transfer from the Cao reference using Azimuth
rmarkdown::render(input = file.path(notebook_template_dir, "02a_label-transfer_fetal_full_reference_Cao.Rmd"),
params = list(scpca_project_id = project_id, sample_id = sample_id),
output_format = "html_document",
output_file = paste0("02a_fetal_all_reference_Cao_", sample_id, ".html"),
output_dir = file.path(notebook_output_dir, sample_id))

# Label transfer from the Stewart reference using Seurat
rmarkdown::render(input = file.path(notebook_template_dir, "02b_label-transfer_fetal_kidney_reference_Stewart.Rmd"),
params = list(scpca_project_id = project_id, sample_id = sample_id),
output_format = "html_document",
output_file = paste0("02b_fetal_kidney_reference_Stewart_", sample_id, ".html"),
output_dir = file.path(notebook_output_dir, sample_id))

# Cluster exploration
rmarkdown::render(input = file.path(notebook_template_dir, "03_clustering_exploration.Rmd"),
params = list(scpca_project_id = project_id, sample_id = sample_id),
output_format = "html_document",
output_file = paste0("03_clustering_exploration_", sample_id, ".html"),
output_dir = file.path(notebook_output_dir, sample_id))

}
}

if (!running_ci) {
for(thr in c(0.5, 0.75, 0.85, 0.95)){
# Run notebook template to explore label transfer and clustering for all samples at once
rmarkdown::render(input = file.path(notebook_output_dir, "04_annotation_Across_Samples_exploration.Rmd"),
params = list(mapping_score_thr = thr),
output_format = "html_document",
output_file = glue::glue("04_annotation_Across_Samples_exploration_mappingscore_threshold_",thr,".html"),
output_dir = notebook_output_dir)
}
# Run infercnv and copykat for a selection of samples
system(command = glue::glue("Rscript ", file.path(module_base,"scripts", "explore-cnv-methods.R")))

}





4 changes: 4 additions & 0 deletions analyses/cell-type-dsrct/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Don't activate renv in an OpenScPCA docker image
if(Sys.getenv('OPENSCPCA_DOCKER') != 'TRUE'){
source('renv/activate.R')
}
13 changes: 13 additions & 0 deletions analyses/cell-type-dsrct/cell-type-dsrct.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
Loading

0 comments on commit 9b36d48

Please sign in to comment.