forked from tidymodels/TMwR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaffy_plm_ggplot.R
38 lines (27 loc) · 1.11 KB
/
affy_plm_ggplot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
library(tidyverse)
library(affyPLM)
library(AmpAffyExample)
# ------------------------------------------------------------------------------
data(AmpData)
sampleNames(AmpData) <- c("N1","Good Quality","Poor Quality","A1","A2","A3")
Pset1 <- fitPLM(AmpData)
# ------------------------------------------------------------------------------
# Take from the image method for PLMset objevts
pm.index <- unlist(affy::indexProbes(Pset1, "pm", row.names(coefs(Pset1))))
rows <- Pset1@nrow
cols <- Pset1@ncol
pm.x.locs <- pm.index %% rows
pm.x.locs[pm.x.locs == 0] <- rows
pm.y.locs <- pm.index %/% rows + 1
# ------------------------------------------------------------------------------
plm_resids <-
tibble::as_tibble(Pset1@residuals$PM.resid) %>%
mutate(
probe = rownames(Pset1@residuals$PM.resid),
x = pm.x.locs,
y = pm.y.locs
) %>%
pivot_longer(cols = c(1:6), names_to = "Sample", values_to = "Intensity") %>%
dplyr::filter(Sample %in% c("Good Quality", "Poor Quality"))
# ------------------------------------------------------------------------------
save(plm_resids, file = "RData/plm_resids.RData")