diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2021-05-02 17:33:26 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2021-05-02 17:33:26 +0200 |
| commit | bf1adece8aeb48e136085233d2f5ff2f9600eaf5 (patch) | |
| tree | 6a46b0c7e7fbea6a85c0e44714e0076251e82cac /scripts/sam.R | |
| parent | de4565fe9290ec1f1031eed6f7d067794df53166 (diff) | |
update
Diffstat (limited to 'scripts/sam.R')
| -rw-r--r-- | scripts/sam.R | 49 |
1 files changed, 49 insertions, 0 deletions
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 |
