-
Notifications
You must be signed in to change notification settings - Fork 2
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 #501 from AlexsLemonade/allyhawkins/v0.5.5
Add in changes for v0.6.0 to main
- Loading branch information
Showing
69 changed files
with
11,323 additions
and
889 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
name: Spell check R Markdown and Markdown files | ||
|
||
# Controls when the action will run. | ||
# Pull requests to development and main only. | ||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
- main | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "spell check" | ||
spell-check: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: rocker/tidyverse:4.2.3 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install packages | ||
run: Rscript --vanilla -e "install.packages(c('spelling'), repos = c(CRAN = '$CRAN'))" | ||
|
||
- name: Run spell check | ||
id: spell_check_run | ||
run: | | ||
results=$(Rscript --vanilla "scripts/spell-check.R") | ||
echo "sp_chk_results=$results" >> $GITHUB_OUTPUT | ||
cat spell_check_errors.tsv | ||
- name: Archive spelling errors | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: spell-check-results | ||
path: spell_check_errors.tsv | ||
|
||
# If there are too many spelling errors, this will stop the workflow | ||
- name: Check spell check results - fail if too many errors | ||
if: ${{ steps.spell_check_run.outputs.sp_chk_results > 0 }} | ||
run: exit 1 |
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 |
---|---|---|
|
@@ -11,3 +11,6 @@ scpca-references/ | |
# ignore template htmls | ||
qc_report.html | ||
*_qc.html | ||
|
||
# ignore hidden `DS_Store` | ||
.DS_Store |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
# This script adds submitter annotations, if provided, to an SCE object's colData. | ||
|
||
# import libraries | ||
suppressPackageStartupMessages({ | ||
library(optparse) | ||
library(SingleCellExperiment) | ||
}) | ||
# set up arguments | ||
option_list <- list( | ||
make_option( | ||
opt_str = c("-f", "--sce_file"), | ||
type = "character", | ||
help = "path to SingleCellExperiment file to update. Must end in .rds" | ||
), | ||
make_option( | ||
opt_str = c("--library_id"), | ||
type = "character", | ||
help = "library id" | ||
), | ||
make_option( | ||
opt_str = c("--submitter_cell_types_file"), | ||
type = "character", | ||
help = "path to tsv file containing submitter-provided cell type annotations" | ||
) | ||
) | ||
|
||
opt <- parse_args(OptionParser(option_list = option_list)) | ||
|
||
# check that output file name ends in .rds | ||
if (!(stringr::str_ends(opt$sce_file, ".rds"))) { | ||
stop("SingleCellExperiment file name must end in .rds") | ||
} | ||
|
||
|
||
# check that submitter cell types file exists | ||
if (!file.exists(opt$submitter_cell_types_file)) { | ||
stop("submitter cell type annotations file not found.") | ||
} | ||
|
||
|
||
# Read in sce | ||
sce <- readr::read_rds(opt$sce_file) | ||
|
||
# Read in celltypes | ||
submitter_cell_types_df <- readr::read_tsv(opt$submitter_cell_types_file) |> | ||
# filter to relevant information | ||
dplyr::filter(scpca_library_id == opt$library_id) |> | ||
dplyr::select( | ||
barcodes = cell_barcode, | ||
submitter_celltype_annotation = cell_type_assignment | ||
) |> | ||
# in the event of NA values, change to "Unclassified cell" | ||
tidyr::replace_na( | ||
list(submitter_celltype_annotation = "Unclassified cell") | ||
) |> | ||
# join with colData | ||
dplyr::right_join( | ||
colData(sce) |> | ||
as.data.frame() | ||
) | ||
|
||
# Check rows before sending back into the SCE object | ||
if (nrow(submitter_cell_types_df) != ncol(sce)) { | ||
stop("Could not add submitter annotations to SCE object. There should only be one annotation per cell.") | ||
} | ||
|
||
# Rejoin with colData, making sure we keep rownames | ||
colData(sce) <- DataFrame( | ||
submitter_cell_types_df, | ||
row.names = colData(sce)$barcodes | ||
) | ||
|
||
# Indicate that we have submitter celltypes in metadata, | ||
# saving in same spot as for actual celltyping | ||
metadata(sce)$celltype_methods <- c(metadata(sce)$celltype_methods, "submitter") | ||
|
||
# Write SCE back to file | ||
readr::write_rds(sce, opt$sce_file, compress = "gz") |
Oops, something went wrong.