Skip to content

Commit

Permalink
Merge pull request #262 from stemangiola/improve-DE-docs
Browse files Browse the repository at this point in the history
add messaging
  • Loading branch information
stemangiola authored Nov 22, 2022
2 parents b6a35e7 + 5cb798c commit 82f172f
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit 82f172f

Please sign in to comment.