Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add messaging #262

Merged
merged 3 commits into from
Nov 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,28 @@ get_differential_transcript_abundance_bulk <- function(.data,
)
)

# Specify the design column tested
if(is.null(.contrasts))
message(
sprintf(
"tidybulk says: The design column being tested is %s",
design %>% colnames %>% .[1]
)
)

# If I don't have intercept or I have categorical factor of interest BUT I don't have contrasts
if(
is.null(.contrasts) &
(
(
! .data |> pull(parse_formula(.formula)[1]) |> is("numeric") &
.data |> pull(parse_formula(.formula)[1]) |> unique() |> length() |> gt(2)
) |
colnames(design)[1] != "(Intercept)"
)
)
warning("tidybulk says: If you have (i) an intercept-free design (i.e. ~ 0 + factor) or you have a categorical factor of interest with more than 2 values you should use the `contrasts` argument.")

my_contrasts =
.contrasts %>%
ifelse_pipe(length(.) > 0,
Expand Down