Last active
August 7, 2024 23:50
-
-
Save mikelove/c93b66e972c79dad81cb02d5d920ee65 to your computer and use it in GitHub Desktop.
Trying out Justin's biocmask implementation of tidyomics for SE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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