Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active August 7, 2024 23:50
Show Gist options
  • Save mikelove/c93b66e972c79dad81cb02d5d920ee65 to your computer and use it in GitHub Desktop.
Save mikelove/c93b66e972c79dad81cb02d5d920ee65 to your computer and use it in GitHub Desktop.
Trying out Justin's biocmask implementation of tidyomics for SE
load_all("../biocmask")
suppressPackageStartupMessages(library(airway))
data(airway)
rowData(airway)$group <- sort(rep(1:10, length=nrow(airway)))
library(tibble)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(purrr))
airway |>
mutate(logcounts = log1p(counts))
airway |>
mutate(rows(rowsum = rowSums(.assays_asis$counts))) |>
rowData() |>
as_tibble() |>
dplyr::select(rowsum)
head(rowSums(assay(airway)))
airway |>
mutate(rows(rowsum = map_dbl(.assays$counts, sum))) |>
rowData()
airway |>
group_by(rows(group)) |>
mutate(sum_counts = sum(counts)) |>
assay("sum_counts") |>
head()
sum(assay(airway)[rowData(airway)$group == 1,])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment