Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
mmRmeta/example/statistical.test.R
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
28 lines (20 sloc)
1.87 KB
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
### Statisticla Test | |
#kruskal.test() | |
#if(p value is significant) | |
# do(wilcox test, but only with more than | |
lungDiagnosisExpressionKruskal <- make.kruskal.frame(lungMetaExpression, 13, "primary_diagnosis") | |
x <- rownames(subset(lungDiagnosisExpressionKruskal, lungDiagnosisExpressionKruskal[1] < 0.05)) #filter significant data | |
x1 <- pairwise.wilcox.test(lungMetaExpression[[x[1]]]$expression, g = lungMetaExpression[[x[1]]][["primary_diagnosis"]], p.adj = "bonf")$p.value %>% data.frame() | |
x2 <- x1 %>% tibble::rownames_to_column('name') %>% filter_all(. , any_vars(. < 0.05)) %>% tibble::column_to_rownames('name') #filter and keep rownames | |
x3 <- data.frame(t(x2)) %>% tibble::rownames_to_column('name') %>% filter_all(., any_vars(. < 0.05)) %>% tibble::column_to_rownames('name') #transpose to filter out rows without significant values, cant filter out colums that easy | |
wilcox_test(Value ~ factor(Group), data=data[data$Group==1|data$Group==2,]) | |
xWil <- wilcox.test(lungMetaExpression[[x[1]]]$expression ~ lungMetaExpression[[x[1]]]$primary_diagnosis == c("Adenocarcinoma, NOS" , "Squamous cell carninoma, NOS")) | |
#for every row: do wilcox test if p.value is <0.05 and not the same name ... furthermore try coin::wilcox_test | |
rownames(x3) | |
#what if i subset expression values byy diagnosis factor | |
primaryDSpread <- lungMetaExpression$AL671277.1 %>% select(. , c(case_id, primary_diagnosis, expression)) %>% tidyr::spread(., primary_diagnosis, expression) | |
wilcox.test(primaryD$`Papillary adenocarcinoma, NOS`, primaryD$`Papillary adenocarcinoma, NOS`) | |
primaryD <- lungMetaExpression$AL671277.1 %>% select(. , primary_diagnosis, expression) | |
firstTest <- filter(primaryD, primary_diagnosis %in% c("Adenocarcinoma, NOS", "Squamous cell carcinoma, NOS")) #filter if they are named like this | |
coin::wilcox_test(formula = expression ~ primary_diagnosis, data = firstTest) | |
# FUNKTIONIERT |