Skip to content

Commit

Permalink
fix & quiet test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jashapiro committed Aug 16, 2023
1 parent e0cc85a commit 9f5c775
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 21 deletions.
20 changes: 15 additions & 5 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
^requirements\.txt$
# Github and docs
^\.github$
^CONTRIBUTING\.md$

# user settings
^.*\.Rproj$
^\.Rproj\.user$

# renv files
^renv$
^renv\.lock$
^dependencies\.R$
^.*\.Rproj$
^\.Rproj\.user$
^\.github$
^README\.Rmd$
^requirements\.txt$
^\.venv$

# rendered notebooks
^inst/rmd/.*\.html$

# Docker folder
^docker$
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:

jobs:
build_and_push:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
Expand Down
11 changes: 5 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: scpcaTools
Type: Package
Title: Single cell data tools for ScPCA
Version: 0.2.3
Version: 0.3.0
Authors@R: c(
person("Ally", "Hawkins",
email = "[email protected]",
Expand All @@ -27,10 +27,10 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
Depends:
R (>= 4.2.0)
R (>= 4.3.0)
Imports:
BiocGenerics,
bluster,
bluster (>= 1.10),
dplyr,
DropletUtils,
fishpond,
Expand All @@ -39,7 +39,7 @@ Imports:
jsonlite,
Matrix,
methods,
miQC (>= 1.2.0),
miQC,
purrr,
rlang,
S4Vectors,
Expand All @@ -66,6 +66,5 @@ Suggests:
testthat (>= 3.0.0),
zellkonverter
Remotes:
AlexsLemonade/scpcaData,
github::immunogenomics/lisi
AlexsLemonade/scpcaData
Config/testthat/edition: 3
9 changes: 5 additions & 4 deletions R/calculate_ilisi.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' is a normalized version if `ilisi_score` where values range from [0,1], inclusive
#'
#' @import SingleCellExperiment
#' @importFrom rlang .data
#'
#' @export
calculate_ilisi <- function(merged_sce,
Expand Down Expand Up @@ -52,17 +53,17 @@ calculate_ilisi <- function(merged_sce,
ilisi_df <- lisi::compute_lisi(
labeled_pcs,
# define the batches
batch_df,
meta_data = batch_df,
# which variables in `batch_df` to compute lisi for
"batch"
label_colnames = "batch"
) |>
dplyr::rename(ilisi_score = batch) |>
dplyr::rename("ilisi_score" = "batch") |>
dplyr::mutate(
cell_barcode = rownames(labeled_pcs),
batch_id = batch_df$batch,
# add normalized iLISI score as in in scib approach:
# https://github.com/theislab/scib/blob/067eb1aee7044f5ce0652fa363ec8deab0e9668d/scib/metrics/lisi.py#L98-L100
ilisi_score_norm = (ilisi_score - 1)/(num_batches - 1)
ilisi_score_norm = (.data$ilisi_score - 1)/(num_batches - 1)
)

# Return data frame with cell-wise iLISI scores and associated cell & batch identifiers
Expand Down
3 changes: 2 additions & 1 deletion R/integrate_sces.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ integrate_fastmnn <- function(merged_sce,
#' being integrated.
#' @param covariate_cols A vector of other columns to consider as
#' covariates during integration.
#' @param ... Additional arguments to pass into `harmony::harmonyMatrix()`
#' @param ... Additional arguments to pass into `harmony::HarmonyMatrix()`
#'
#' @return Integrated PCs as calculated by `harmony`
#'
Expand Down Expand Up @@ -183,6 +183,7 @@ integrate_harmony <- function(merged_sce,
harmony_results <- harmony::HarmonyMatrix(reducedDim(merged_sce, "PCA"),
meta_data = harmony_metadata,
vars_use = covariate_cols,
verbose = FALSE,
...
)
# Ensure PCs have rownames
Expand Down
2 changes: 1 addition & 1 deletion man/integrate_harmony.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/testthat/test-collapse_intron_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ test_that("Check spliced collapse", {
)
})

test_that("Check unspliced collapse", {
collapsed_mat <- collapse_intron_counts(intron_mat, "unspliced")
collapsed_usa <- collapse_intron_counts(usa_mat, "unspliced")
test_that("Check total(unspliced) collapse", {
collapsed_mat <- collapse_intron_counts(intron_mat, "total")
collapsed_usa <- collapse_intron_counts(usa_mat, "total")
# check the contents
expect_equal(
collapsed_mat@x,
Expand Down

0 comments on commit 9f5c775

Please sign in to comment.