-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from sjspielman/sjspielman/544-doublets-on-scpca
Detect doublets in ScPCA data
- Loading branch information
Showing
13 changed files
with
263 additions
and
3,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,919 changes: 0 additions & 2,919 deletions
2,919
analyses/doublet-detection/exploratory-notebooks/03_compare-benchmark-results.nb.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
analyses/doublet-detection/run_doublet-detection-benchmark.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
# This script runs the benchmarking portion of the `doublet-detection` module | ||
|
||
set -euo pipefail | ||
|
||
|
||
# Set up -------------- | ||
|
||
# Ensure script is being run from its directory | ||
MODULE_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
cd ${MODULE_DIR} | ||
|
||
TEMPLATE_NB_DIR="template-notebooks" # directory with template notebooks | ||
EXPLORE_NB_DIR="exploratory-notebooks" # directory with exploratory notebooks | ||
|
||
# Create benchmark directories | ||
DATA_DIR="scratch/benchmark-datasets" | ||
RESULTS_DIR="results/benchmark-results" | ||
RESULTS_NB_DIR="${RESULTS_DIR}/rendered-notebooks" | ||
mkdir -p ${DATA_DIR} | ||
mkdir -p ${RESULTS_DIR} | ||
mkdir -p ${RESULTS_NB_DIR} | ||
|
||
|
||
# define benchmarking datasets to use | ||
bench_datasets=("hm-6k" "pbmc-1B-dm" "pdx-MULTI" "HMEC-orig-MULTI") | ||
|
||
# Download and unzip `real_datasets.zip` archive from https://doi.org/10.5281/zenodo.4562782 | ||
# Files are saved in $DATA_DIR/raw | ||
wget https://zenodo.org/records/4562782/files/real_datasets.zip | ||
unzip real_datasets.zip -d ${DATA_DIR}/raw | ||
rm real_datasets.zip | ||
|
||
for dataset in "${bench_datasets[@]}"; do | ||
|
||
# formatted SCE and AnnData files will be saved here | ||
DATASET_DIR=${DATA_DIR}/$dataset | ||
mkdir -p $DATASET_DIR | ||
|
||
# Read raw downloaded data and export SCE, AnnData files | ||
./scripts/00_format-benchmark-data.R --dataset ${dataset} --input_dir ${DATA_DIR}/raw --output_dir ${DATASET_DIR} | ||
|
||
# Infer doublets with scDblFinder | ||
./scripts/01a_run-scdblfinder.R --input_sce_file ${DATASET_DIR}/${dataset}.rds --results_dir ${RESULTS_DIR} --benchmark | ||
|
||
# Infer doublets with scrublet | ||
./scripts/01b_run-scrublet.py --input_anndata_file ${DATASET_DIR}/${dataset}.h5ad --results_dir ${RESULTS_DIR} | ||
|
||
# Explore each individual set of doublet results | ||
Rscript -e "rmarkdown::render('${TEMPLATE_NB_DIR}/02_explore-benchmark-results.Rmd', | ||
output_dir = '${RESULTS_NB_DIR}', | ||
output_file = '${dataset}_doublet-results.html', | ||
params = list(dataset = '${dataset}'), | ||
clean = TRUE)" | ||
done | ||
|
||
# Compare doublet inferences across methods, on all datasets processed | ||
Rscript -e "rmarkdown::render('${EXPLORE_NB_DIR}/03_compare-benchmark-results.Rmd', | ||
output_dir = '${RESULTS_NB_DIR}', | ||
output_file = 'compare-benchmark-results.nb.html', | ||
clean = TRUE)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# This script runs doublet detection over ScPCA data for a given project | ||
# Usage: ./run_doublet-detection-scpca.sh {scpca project id} | ||
|
||
set -euo pipefail | ||
|
||
|
||
# Ensure script is being run from its directory | ||
MODULE_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
cd ${MODULE_DIR} | ||
|
||
PROJECT_ID=$1 | ||
|
||
# Define directories | ||
DATA_DIR="../../data/current" | ||
RESULTS_DIR="results/scpca-results/${PROJECT_ID}" | ||
mkdir -p ${RESULTS_DIR} | ||
|
||
# Detect doublets on each processed SCE file in each sample directory | ||
for SAMPLE_DIR in ${DATA_DIR}/${PROJECT_ID}/SCPCS*; do | ||
SAMPLE_ID=$(basename $SAMPLE_DIR) | ||
echo "Processing ${SAMPLE_ID}..." | ||
|
||
SAMPLE_RESULTS_DIR=${RESULTS_DIR}/${SAMPLE_ID} | ||
mkdir -p ${SAMPLE_RESULTS_DIR} | ||
|
||
for SCE_FILE in ${SAMPLE_DIR}/*_processed.rds; do | ||
Rscript scripts/01a_run-scdblfinder.R \ | ||
--input_sce_file ${SCE_FILE} \ | ||
--results_dir ${SAMPLE_RESULTS_DIR} | ||
done | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.