Skip to content

Commit

Permalink
Update to include "by" variable from Hackathon Spring 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
toumban1 committed Aug 14, 2024
1 parent 35555ee commit 407da12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/subset-by-frequency.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ subset_by_frequency <- function(gene_binary, t = .1, other_vars = NULL, by = NUL

alt_data <-
alt_only |>
group_by(by) |>
summarise(across(-c(by), sum = ~ sum(.), total = ~ sum(!is.na(.))), na.rm = T)
group_by(across(any_of(by))) |>
summarise_all(list(sum = ~ sum(.), total = ~ sum(!is.na(.))), na.rm = T)

alt_group_data <-
alt_data |>
Expand All @@ -107,12 +107,12 @@ subset_by_frequency <- function(gene_binary, t = .1, other_vars = NULL, by = NUL
separate(gene, into = c("gene", "measure"), sep = "_") |>
pivot_wider(names_from = measure,
values_from = value) |>
mutate(prop = sum/total) |>
arrange(desc(prop))
mutate(propo = sum/total) |>
arrange(desc(propo))

alts_over_thresh_grp <-
alt_group_data |>
filter(prop > t) |>
filter(propo > t) |>
group_by(gene) |>
select(gene) |>
unique() |>
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.

0 comments on commit 407da12

Please sign in to comment.