Skip to content

Commit

Permalink
add design to filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Dec 13, 2024
1 parent c7b4eae commit b04680a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
6 changes: 6 additions & 0 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,7 @@ setGeneric("identify_abundant", function(.data,
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
standardGeneric("identify_abundant"))
Expand All @@ -3142,6 +3143,7 @@ setGeneric("identify_abundant", function(.data,
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
{
Expand Down Expand Up @@ -3250,6 +3252,7 @@ setGeneric("identify_abundant", function(.data,
edgeR::filterByExpr(
min.count = minimum_counts,
group = string_factor_of_interest,
design = design,
min.prop = minimum_proportion
) %>%
not() |>
Expand Down Expand Up @@ -3345,6 +3348,7 @@ setGeneric("keep_abundant", function(.data,
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
standardGeneric("keep_abundant"))
Expand All @@ -3355,6 +3359,7 @@ setGeneric("keep_abundant", function(.data,
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
{
Expand Down Expand Up @@ -3387,6 +3392,7 @@ setGeneric("keep_abundant", function(.data,
.transcript = !!.transcript,
.abundance = !!.abundance,
factor_of_interest = !!factor_of_interest,
design = design,
minimum_counts = minimum_counts,
minimum_proportion = minimum_proportion
) |>
Expand Down
18 changes: 11 additions & 7 deletions R/methods_SE.R
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ setMethod("keep_variable",
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
{
Expand Down Expand Up @@ -1679,6 +1680,7 @@ setMethod("keep_variable",
edgeR::filterByExpr(
min.count = minimum_counts,
group = string_factor_of_interest,
design = design,
min.prop = minimum_proportion,
lib.size = Matrix::colSums(., na.rm=TRUE)
) %>%
Expand Down Expand Up @@ -1726,6 +1728,7 @@ setMethod("identify_abundant",
.transcript = NULL,
.abundance = NULL,
factor_of_interest = NULL,
design = NULL,
minimum_counts = 10,
minimum_proportion = 0.7)
{
Expand All @@ -1745,7 +1748,8 @@ setMethod("identify_abundant",
factor_of_interest = !!factor_of_interest,
minimum_counts = minimum_counts,
minimum_proportion = minimum_proportion,
.abundance = !!.abundance
.abundance = !!.abundance,
design = design
)

.data[rowData(.data)$.abundant,]
Expand Down Expand Up @@ -2818,14 +2822,14 @@ setMethod("describe_transcript", "RangedSummarizedExperiment", .describe_transcr
#' @importFrom SummarizedExperiment as.data.frame
.resolve_complete_confounders_of_non_interest <- function(se, ...){

colData(se) =
colData(se) |>
as.data.frame() |>
.resolve_complete_confounders_of_non_interest_df(...) |>
colData(se) =
colData(se) |>
as.data.frame() |>
.resolve_complete_confounders_of_non_interest_df(...) |>
DataFrame()

se

}

#' resolve_complete_confounders_of_non_interest
Expand Down
6 changes: 6 additions & 0 deletions man/identify_abundant-methods.Rd

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

6 changes: 6 additions & 0 deletions man/keep_abundant-methods.Rd

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

14 changes: 7 additions & 7 deletions man/resolve_complete_confounders_of_non_interest.Rd

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

0 comments on commit b04680a

Please sign in to comment.