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

04- Explore the mapping scores for Wilms tumor -06 #835

Merged
merged 24 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6f914c1
Add files via upload
maud-p Oct 21, 2024
f111dbc
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
0e4b03a
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
9a97a33
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
baaada9
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
6f58dcf
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
be700ca
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
f5bd6f3
Update analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 22, 2024
13a97a4
update threshold exploration
maud-p Oct 22, 2024
c01c2e6
update threshold exploration
maud-p Oct 22, 2024
94e4881
Update README.md file
maud-p Oct 28, 2024
0a27a39
update notebook and reports
maud-p Oct 28, 2024
6b53a61
Update README.md file
maud-p Oct 28, 2024
ef48739
Update README.md
maud-p Oct 28, 2024
c542128
Delete analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 28, 2024
1437b36
Delete analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 28, 2024
156f3ab
Delete analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 28, 2024
226d44b
Delete analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 28, 2024
85c8406
Delete analyses/cell-type-wilms-tumor-06/notebook/04_annotation_Acros…
maud-p Oct 28, 2024
a82584b
update mapping_score --> predicted.score
maud-p Oct 28, 2024
c1e6465
update mapping --> predicted.score
maud-p Oct 28, 2024
e98126d
update param argument mapping --> predicted.score
maud-p Oct 28, 2024
2cbb62b
update params for "04_annotation_Across_Samples_exploration.Rmd" mapp…
maud-p Oct 28, 2024
abe48ec
Merge branch 'main' into 04_explore_mapping_score
sjspielman Oct 29, 2024
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
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")))

}





6 changes: 4 additions & 2 deletions analyses/cell-type-wilms-tumor-06/00_run_workflow.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ for (sample_id in metadata$scpca_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(predicted.score_thr = thr),
output_format = "html_document",
output_file = "04_annotation_Across_Samples_exploration.html",
output_file = glue::glue("04_annotation_Across_Samples_exploration_predicted.score_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")))

Expand Down
Loading
Loading