Skip to content

Commit

Permalink
Merge branch 'master' into chilampoon-improve-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola authored Feb 12, 2024
2 parents e174749 + 58d3439 commit 59862f2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 20 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/rworkflows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
name: rworkflows
on:
'on':
push:
branches:
- master
- main
- devel
- RELEASE_**
pull_request:
branches:
- master
- main
- devel
- RELEASE_**
jobs:
rworkflows:
permissions: write-all
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ importFrom(tidyr,replace_na)
importFrom(tidyr,spread)
importFrom(tidyr,unite)
importFrom(tidyr,unnest)
importFrom(tidyselect,one_of)
importFrom(tidyselect,any_of)
importFrom(ttservice,bind_cols)
importFrom(ttservice,bind_rows)
importFrom(utils,capture.output)
Expand Down
18 changes: 9 additions & 9 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ create_tt_from_bam_sam_bulk <- function(file_names, genome = "hg38", ...) {
genes %>%
select(
suppressWarnings(
one_of("GeneID", "symbol")
any_of("GeneID", "symbol")
)
) %>%
as_tibble() %>%
Expand Down Expand Up @@ -434,7 +434,7 @@ get_differential_transcript_abundance_bulk <- function(data,
select(!!.transcript,
!!.sample,
!!.abundance,
one_of(parse_formula(.formula))) %>%
any_of(parse_formula(.formula))) %>%
distinct() %>%

# drop factors as it can affect design matrix
Expand All @@ -454,14 +454,14 @@ get_differential_transcript_abundance_bulk <- function(data,
# if (
# # If I have some discrete covariates
# df_for_edgeR %>%
# select(one_of(parse_formula(.formula))) %>%
# select(any_of(parse_formula(.formula))) %>%
# select_if(function(col)
# is.character(col) | is.factor(col) | is.logical(col)) %>%
# ncol %>% gt(0) &
#
# # If I have at least 2 samples per group
# df_for_edgeR %>%
# select(!!.sample, one_of(parse_formula(.formula))) %>%
# select(!!.sample, any_of(parse_formula(.formula))) %>%
# select_if(function(col) !is.numeric(col) & !is.integer(col) & !is.double(col) ) %>%
# distinct %>%
# group_by_at(vars(-!!.sample)) %>%
Expand Down Expand Up @@ -821,7 +821,7 @@ get_differential_transcript_abundance_glmmSeq <- function(.data,
# Create design matrix for dispersion, removing random effects
design =
model.matrix(
object = .formula |> eliminate_random_effects(),
object = .formula |> lme4::nobars(),
data = metadata
)

Expand Down Expand Up @@ -950,7 +950,7 @@ get_differential_transcript_abundance_bulk_voom <- function(.data,
select(!!.transcript,
!!.sample,
!!.abundance,
one_of(parse_formula(.formula))) %>%
any_of(parse_formula(.formula))) %>%
distinct() %>%

# drop factors as it can affect design matrix
Expand Down Expand Up @@ -1215,7 +1215,7 @@ get_differential_transcript_abundance_deseq2 <- function(.data,
select(!!.transcript,
!!.sample,
!!.abundance,
one_of(parse_formula(.formula))) %>%
any_of(parse_formula(.formula))) %>%
distinct() %>%

# drop factors as it can affect design matrix
Expand Down Expand Up @@ -1639,15 +1639,15 @@ test_gene_enrichment_bulk_EGSEA <- function(.data,

# Prepare the data frame
select(!!.entrez, !!.sample, !!.abundance,
one_of(parse_formula(.formula))) %>%
any_of(parse_formula(.formula))) %>%
distinct() %>%

# Add entrez from symbol
filter(!!.entrez %>% is.na %>% not())

# Check if at least two samples for each group
if (df_for_edgeR %>%
select(!!.sample, one_of(parse_formula(.formula))) %>%
select(!!.sample, any_of(parse_formula(.formula))) %>%
distinct %>%
count(!!as.symbol(parse_formula(.formula))) %>%
distinct(n) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/methods_SE.R
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ setMethod("adjust_abundance",
new_range_data = new_range_data %>%

# I have to use this trick because rowRanges() and rowData() share @elementMetadata
select(-one_of(colnames(new_row_data) %>% outersect(quo_name(.transcript)))) %>%
select(-any_of(colnames(new_row_data) %>% outersect(quo_name(.transcript)))) %>%
suppressWarnings()


Expand Down
14 changes: 7 additions & 7 deletions R/tidySummarizedExperiment.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
eliminate_GRanges_metadata_columns_also_present_in_Rowdata = function(.my_data, se){
.my_data %>%
select(-one_of(colnames(rowData(se)))) %>%
select(-any_of(colnames(rowData(se)))) %>%

# In case there is not metadata column
suppressWarnings()
}


#' @importFrom dplyr select
#' @importFrom tidyselect one_of
#' @importFrom tidyselect any_of
#' @importFrom tibble as_tibble
#' @importFrom tibble tibble
#' @importFrom SummarizedExperiment rowRanges
Expand Down Expand Up @@ -146,7 +146,7 @@ subset_tibble_output = function(.data, count_info, sample_info, gene_info, range
sample_info %>%
when(
colnames(.) %>% intersect(output_colnames) %>% length() %>% equals(0) ~ NULL,
select(., one_of(s_(.data)$name, output_colnames)) %>%
select(., any_of(s_(.data)$name, output_colnames)) %>%
suppressWarnings()
)

Expand All @@ -155,7 +155,7 @@ subset_tibble_output = function(.data, count_info, sample_info, gene_info, range
range_info %>%
when(
colnames(.) %>% intersect(output_colnames) %>% length() %>% equals(0) ~ NULL,
select(., one_of(f_(.data)$name, output_colnames)) %>%
select(., any_of(f_(.data)$name, output_colnames)) %>%
suppressWarnings()
)

Expand All @@ -164,7 +164,7 @@ subset_tibble_output = function(.data, count_info, sample_info, gene_info, range
gene_info %>%
when(
colnames(.) %>% intersect(output_colnames) %>% length() %>% equals(0) ~ NULL,
select(., one_of(f_(.data)$name, output_colnames)) %>%
select(., any_of(f_(.data)$name, output_colnames)) %>%
suppressWarnings()
)

Expand All @@ -173,7 +173,7 @@ subset_tibble_output = function(.data, count_info, sample_info, gene_info, range
count_info %>%
when(
colnames(.) %>% intersect(output_colnames) %>% length() %>% equals(0) ~ NULL,
select(., one_of(f_(.data)$name, s_(.data)$name, output_colnames)) %>%
select(., any_of(f_(.data)$name, s_(.data)$name, output_colnames)) %>%
suppressWarnings()
)

Expand Down Expand Up @@ -206,7 +206,7 @@ subset_tibble_output = function(.data, count_info, sample_info, gene_info, range
output_df %>%

# Cleanup
select(one_of(output_colnames)) %>%
select(any_of(output_colnames)) %>%
suppressWarnings()

}
Expand Down
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ scale_design = function(df, .formula) {
ungroup() %>%
spread(cov, value) %>%
arrange(as.integer(sample_idx)) %>%
select(`(Intercept)`, one_of(parse_formula(.formula)))
select(`(Intercept)`, any_of(parse_formula(.formula)))
}

get_tt_columns = function(.data){
Expand Down

0 comments on commit 59862f2

Please sign in to comment.