Skip to content

Commit

Permalink
Merge pull request #310 from stemangiola/fix-Bioc-ERROR
Browse files Browse the repository at this point in the history
Fix bioc error
  • Loading branch information
stemangiola authored Feb 7, 2024
2 parents 915117b + 94edb1d commit c0f4e86
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 37 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: tidybulk
Title: Brings transcriptomics to the tidyverse
Version: 1.15.4
Version: 1.15.5
Authors@R: c(person("Stefano", "Mangiola", email = "mangiolastefano@gmail.com",
role = c("aut", "cre")),
person("Maria", "Doyle", email = "Maria.Doyle@petermac.org",
Expand Down Expand Up @@ -95,7 +95,7 @@ Biarch: true
biocViews: AssayDomain, Infrastructure, RNASeq, DifferentialExpression, GeneExpression, Normalization, Clustering, QualityControl, Sequencing, Transcription, Transcriptomics
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
LazyDataCompression: xz
URL: https://github.com/stemangiola/tidybulk
BugReports: https://github.com/stemangiola/tidybulk/issues
10 changes: 5 additions & 5 deletions R/glmmSeq.R
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ glmmSeq = function (modelFormula, countdata, metadata, id = NULL, dispersion = N
resultList <- lapply(fullList, function(geneList) {
glmerCore(geneList, fullFormula, reduced,
subsetMetadata, control, offset, modelData,
designMatrix, hyp.matrix,, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
designMatrix, hyp.matrix, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
})
}
else if (Sys.info()["sysname"] == "Windows" & cores > 1) {
Expand Down Expand Up @@ -618,7 +618,7 @@ glmmSeq = function (modelFormula, countdata, metadata, id = NULL, dispersion = N
}
else {
if(avoid_forking){
library(parallel)
#library(parallel)
cl = parallel::makeCluster(cores, type = "PSOCK")
#parallel::clusterEvalQ(cl,c(library(dplyr),library(glmmSeq)))
#clusterExport(cl, list("varname1", "varname2"),envir=environment())
Expand All @@ -628,7 +628,7 @@ glmmSeq = function (modelFormula, countdata, metadata, id = NULL, dispersion = N
function(geneList) {
glmerCore(geneList, fullFormula, reduced,
subsetMetadata, control, offset, modelData,
designMatrix, hyp.matrix,, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
designMatrix, hyp.matrix, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
}
)
}
Expand All @@ -645,7 +645,7 @@ glmmSeq = function (modelFormula, countdata, metadata, id = NULL, dispersion = N
resultList <- pbmcapply::pbmclapply(fullList, function(geneList) {
glmerCore(geneList, fullFormula, reduced,
subsetMetadata, control, offset, modelData,
designMatrix, hyp.matrix, , max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
designMatrix, hyp.matrix, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
}, mc.cores = cores)
if ("value" %in% names(resultList)) resultList <- resultList$value

Expand All @@ -654,7 +654,7 @@ glmmSeq = function (modelFormula, countdata, metadata, id = NULL, dispersion = N
resultList <- mclapply(fullList, function(geneList) {
glmerCore(geneList, fullFormula, reduced,
subsetMetadata, control, offset, modelData,
designMatrix, hyp.matrix,, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
designMatrix, hyp.matrix, max_rows_for_matrix_multiplication = max_rows_for_matrix_multiplication, ...)
}, mc.cores = cores)

}
Expand Down
50 changes: 25 additions & 25 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ setOldClass("tidybulk")
#'
#' @importFrom rlang enquo
#' @importFrom rlang quo_is_missing
#' @importFrom magrittr "%>%"
#'
#' @import readr
#' @import SummarizedExperiment
#' @import methods
Expand Down Expand Up @@ -302,7 +302,7 @@ setMethod("as_SummarizedExperiment", "tidybulk", .as_SummarizedExperiment)
#' @description tidybulk_SAM_BAM() creates a `tt` object from A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment))
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name tidybulk_SAM_BAM
#'
Expand Down Expand Up @@ -352,7 +352,7 @@ setMethod("tidybulk_SAM_BAM", c(file_names = "character", genome = "character"),
#' @description scale_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and Scales transcript abundance compansating for sequencing depth (e.g., with TMM algorithm, Robinson and Oshlack doi.org/10.1186/gb-2010-11-3-r25).
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#' @importFrom stats median
#'
#' @name scale_abundance
Expand Down Expand Up @@ -576,7 +576,7 @@ setMethod("scale_abundance", "tidybulk", .scale_abundance)
#' @description quantile_normalise_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and Scales transcript abundance compansating for sequencing depth (e.g., with TMM algorithm, Robinson and Oshlack doi.org/10.1186/gb-2010-11-3-r25).
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#' @importFrom stats median
#' @importFrom dplyr join_by
#'
Expand Down Expand Up @@ -781,7 +781,7 @@ setMethod("quantile_normalise_abundance", "tidybulk", .quantile_normalise_abunda
#' @description cluster_elements() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and identify clusters in the data.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name cluster_elements
#'
Expand Down Expand Up @@ -998,7 +998,7 @@ setMethod("cluster_elements", "tidybulk", .cluster_elements)
#' @description reduce_dimensions() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and calculates the reduced dimensional space of the transcript abundance.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name reduce_dimensions
#'
Expand Down Expand Up @@ -1285,7 +1285,7 @@ setMethod("reduce_dimensions", "tidybulk", .reduce_dimensions)
#' @description rotate_dimensions() takes as input a `tbl` formatted as | <DIMENSION 1> | <DIMENSION 2> | <...> | and calculates the rotated dimensional space of the transcript abundance.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name rotate_dimensions
#'
Expand Down Expand Up @@ -1464,7 +1464,7 @@ setMethod("rotate_dimensions", "tidybulk", .rotate_dimensions)
#' @description remove_redundancy() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) for correlation method or | <DIMENSION 1> | <DIMENSION 2> | <...> | for reduced_dimensions method, and returns a consistent object (to the input) with dropped elements (e.g., samples).
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name remove_redundancy
#'
Expand Down Expand Up @@ -1681,7 +1681,7 @@ setMethod("remove_redundancy", "tidybulk", .remove_redundancy)
#' @description adjust_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with an additional adjusted abundance column. This method uses scaled counts if present.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name adjust_abundance
#'
Expand Down Expand Up @@ -1943,7 +1943,7 @@ setMethod("adjust_abundance", "tidybulk", .adjust_abundance)
#' @description aggregate_duplicates() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with aggregated transcripts that were duplicated.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name aggregate_duplicates
#'
Expand Down Expand Up @@ -2093,7 +2093,7 @@ setMethod("aggregate_duplicates", "tidybulk", .aggregate_duplicates)
#' @description deconvolve_cellularity() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with the estimated cell type abundance for each sample
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name deconvolve_cellularity
#'
Expand Down Expand Up @@ -2455,7 +2455,7 @@ setMethod("describe_transcript", "tidybulk", .describe_transcript)
#' @description ensembl_to_symbol() takes as input a `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with the additional transcript symbol column
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name ensembl_to_symbol
#'
Expand Down Expand Up @@ -2573,7 +2573,7 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol)
#' @description test_differential_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name test_differential_abundance
#'
Expand Down Expand Up @@ -2993,7 +2993,7 @@ setMethod("test_differential_abundance",
#' @description keep_variable() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name keep_variable
#'
Expand Down Expand Up @@ -3120,7 +3120,7 @@ setMethod("keep_variable", "tidybulk", .keep_variable)
#' @description identify_abundant() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#' @importFrom dplyr filter
#' @importFrom tidyr drop_na
#'
Expand Down Expand Up @@ -3339,7 +3339,7 @@ setMethod("identify_abundant", "tidybulk", .identify_abundant)
#' @description keep_abundant() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#' @importFrom dplyr filter
#'
#' @name keep_abundant
Expand Down Expand Up @@ -3472,7 +3472,7 @@ setMethod("keep_abundant", "tidybulk", .keep_abundant)
#' @description test_gene_enrichment() takes as input a `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a `tbl` of gene set information
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name test_gene_enrichment
#'
Expand Down Expand Up @@ -3706,7 +3706,7 @@ setMethod("test_gene_enrichment",
#'
#' @importFrom rlang enquo
#' @importFrom rlang quo_is_missing
#' @importFrom magrittr "%>%"
#'
#'
#' @name test_gene_overrepresentation
#'
Expand Down Expand Up @@ -3865,7 +3865,7 @@ setMethod("test_gene_overrepresentation",
#'
#' @importFrom rlang enquo
#' @importFrom rlang quo_is_missing
#' @importFrom magrittr "%>%"
#'
#'
#' @name test_gene_rank
#'
Expand Down Expand Up @@ -4074,7 +4074,7 @@ setMethod("test_gene_rank",
#'
#' @description pivot_sample() takes as input a `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a `tbl` with only sample-related columns
#'
#' @importFrom magrittr "%>%"
#'
#'
#' @name pivot_sample
#'
Expand Down Expand Up @@ -4163,7 +4163,7 @@ setMethod("pivot_sample",
#'
#' @description pivot_transcript() takes as input a `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a `tbl` with only transcript-related columns
#'
#' @importFrom magrittr "%>%"
#'
#'
#' @name pivot_transcript
#'
Expand Down Expand Up @@ -4254,7 +4254,7 @@ setMethod("pivot_transcript",
#' @description fill_missing_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with new observations
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name fill_missing_abundance
#'
Expand Down Expand Up @@ -4361,7 +4361,7 @@ setMethod("fill_missing_abundance", "tidybulk", .fill_missing_abundance)
#' @description impute_missing_abundance() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional sample-transcript pairs with imputed transcript abundance.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name impute_missing_abundance
#'
Expand Down Expand Up @@ -4658,7 +4658,7 @@ setMethod("test_differential_cellularity",
#' @description test_stratification_cellularity() takes as input A `tbl` (with at least three columns for sample, feature and transcript abundance) or `SummarizedExperiment` (more convenient if abstracted to tibble with library(tidySummarizedExperiment)) and returns a consistent object (to the input) with additional columns for the statistics from the hypothesis test.
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#' @importFrom stringr str_detect
#'
#' @name test_stratification_cellularity
Expand Down Expand Up @@ -4802,7 +4802,7 @@ setMethod("test_stratification_cellularity",
#' @description get_bibliography() takes as input a `tidybulk`
#'
#' @importFrom rlang enquo
#' @importFrom magrittr "%>%"
#'
#'
#' @name get_bibliography
#'
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-bulk_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ test_that("differential trancript abundance - random effects",{

filter(b %in% c("ABCB4" , "ABCB9" , "ACAP1", "ACHE", "ACP5" , "ADAM28"))

set.seed(42)
my_input |>
test_differential_abundance(
~ condition + (1 + condition | time),
Expand All @@ -855,7 +856,7 @@ test_that("differential trancript abundance - random effects",{
pull(P_condition_adjusted) |>
head(4) |>
expect_equal(
c(0.03643414, 0.02938584, 0.02938584, 0.03643414),
c(0.02658234, 0.02658234, 0.02658234, 0.04139992),
tolerance=1e-3
)

Expand All @@ -867,7 +868,7 @@ test_that("differential trancript abundance - random effects",{
by = join_by(b, entrez, .abundant)
)


set.seed(42)
my_input |>
test_differential_abundance(
~ condition + (1 + condition | time),
Expand All @@ -882,7 +883,7 @@ test_that("differential trancript abundance - random effects",{
pull(P_condition_adjusted) |>
head(4) |>
expect_equal(
c(0.1081176, 0.1303558, 0.1303558, 0.1693276),
c(0.08686834, 0.14384610, 0.14384610, 0.19750844),
tolerance=1e-2
)

Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-bulk_methods_SummarizedExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ test_that("Voom with treat method",{

test_that("differential trancript abundance - random effects SE",{

set.seed(42)
res =
se_mini[1:10,] |>
identify_abundant(factor_of_interest = condition) |>
Expand All @@ -493,7 +494,7 @@ test_that("differential trancript abundance - random effects SE",{
rowData(res)[,"P_condition_adjusted"] |>
head(4) |>
expect_equal(
c(0.03394914, 0.03394914, 0.03394914, NA),
c(0.1578695, 0.1221392, 0.1221392, 0.2262688),
tolerance=1e-2
)

Expand All @@ -517,7 +518,7 @@ test_that("differential trancript abundance - random effects SE",{
rowData(res)[,"P_condition_adjusted"] |>
head(4) |>
expect_equal(
c(0.1153254, 0.1668555, 0.1668555 , NA),
c(0.2633982, 0.2633982, 0.2633982, 0.5028348),
tolerance=1e-2
)

Expand Down

0 comments on commit c0f4e86

Please sign in to comment.