Run Kruskal-Wallis on all columns vs. one column

179 Views Asked by At

I have a matrix of values and I have 4 groups. I want to test for significance of each column between the 4 groups and get the p.values.

gene1       gene2       gene3       gene4       gene5       gene6     tissue    
6194.015    12538.513   6402.715    37657.281   5112.06674  2900.9386   2
6590.853    13000.251   6524.171    6348.666    1128.63516  599.8895    3
3726.607    7558.826    3752.667    6858.63     244.1428    818.1527    4
3499.077    7011.205    3554.496    4543.82     246.97947   709.815     1
5258.485    10514.495   5254.297    11610.092   896.65712   538.375     1
3271.914    6571.995    3288.089    5711.905    413.86977   357.5344    3
5037.359    9928.198    4968.798    10830.359   676.5749    351.8337    2
6658.979    13278.01    6722.473    8823.899    1409.33648  406.3188    4

Any help or suggestions would be greatly appreciated. I've tried to do this with limma as well, but I had too many significant genes, so I believe its incorrect.

1

There are 1 best solutions below

0
On

Nev, you seem to have some contradictory lines of code:

  1. exprs <- matrix(as.numeric(exprs[,2:(ncol(exprs)-1)]),nrow=nrow(exprs)) changes the data frame to a matrix, so exprs$tissue will not make sense. You can get that column as exprs[,7]. Also exprs <- matrix(as.numeric(exprs[,2:(ncol(exprs)-1)]),nrow=nrow(exprs)) is not necessary. You don't have to delete the first and last columns as far as I can tell.

  2. combn seems to be creating a list, not a matrix. So after you create combos, do combos = matrix(unlist(combos), nrow = 2, byrow = TRUE). That makes it a matrix, then you should be able to calculate p.