From bf1adece8aeb48e136085233d2f5ff2f9600eaf5 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sun, 2 May 2021 17:33:26 +0200 Subject: update --- scripts/sam.R | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 scripts/sam.R (limited to 'scripts/sam.R') diff --git a/scripts/sam.R b/scripts/sam.R new file mode 100644 index 0000000..d94794d --- /dev/null +++ b/scripts/sam.R @@ -0,0 +1,49 @@ +library(samr) +library(tidyverse) + +# assumes modelling exploration is loaded in the R session +data1_sam <- data1 %>% + select(donor_id, outcome, Feature, value) %>% + mutate(outcome = factor(outcome, labels = c(1, 2))) %>% + pivot_wider( + names_from = Feature, + values_from = value + ) %>% + select(-donor_id) + +data1_sam_y <- data1_sam[['outcome']] +data1_sam_x <- t(as.data.frame(data1_sam[-1])) + +samobj1 <- samr::SAM( + data1_sam_x, + data1_sam_y, + resp.type="Two class unpaired", + fdr.output = 0.5, + nperms = 1000, + genenames = rownames(data1_sam_x) +) +samobj1 + + +############# DATASET 2 +data2_sam <- data2 %>% + select(donor_id, outcome, Feature, value) %>% + mutate(outcome = factor(outcome, labels = c(1, 2))) %>% + pivot_wider( + names_from = Feature, + values_from = value + ) %>% + select(-donor_id) + +data2_sam_y <- data2_sam[['outcome']] +data2_sam_x <- t(as.data.frame(data2_sam[-1])) + +samobj2 <- samr::SAM( + data2_sam_x, + data2_sam_y, + resp.type="Two class unpaired", + fdr.output = 0.01, + nperms = 1000, + genenames = rownames(data2_sam_x) +) +samobj2 -- cgit v1.2.3