Guest User

Untitled

a guest
Jan 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. > head(biomarker[,1:5])
  2. A2 A3 A4 A6 A7
  3. A2M 12.4071618 12.631601 12.889748 11.842511 11.574134
  4. ABCB11 0.5151957 6.176788 5.414905 7.134915 1.247590
  5. ABCC2 6.7244303 6.487794 10.178615 6.384132 6.089462
  6. ABCC6 6.3977122 5.823627 7.370761 7.397091 6.071587
  7. ABCF1 9.1609847 9.893258 10.116638 10.225520 10.838486
  8. ABCG2 7.6841874 7.738293 6.833152 6.888041 6.030032
  9. >
  10.  
  11. > head(immune[,1:5])
  12. A2 A3 A4 A6 A7
  13. A2M 10.904748 11.388404 9.910614 11.513439 12.963609
  14. ABCB11 5.011380 6.359443 7.145992 8.451947 7.722605
  15. ABCC2 5.040461 6.477014 3.873996 6.409777 9.133971
  16. ABCC6 7.798441 7.601848 9.948072 11.628533 12.701460
  17. ABCF1 8.553597 8.615425 11.145903 10.289098 11.444140
  18. ABCG2 6.224294 5.629375 8.293416 7.979859 8.603793
  19. >
  20.  
  21. > dim(biomarker)
  22. [1] 719 56
  23. > dim(immune)
  24. [1] 719 56
  25. >
  26.  
  27. > f <- function(x,y){
  28. + test <- t.test(x,y, paired=TRUE)
  29. + out <- data.frame(stat = test$statistic,
  30. + df = test$parameter,
  31. + pval = test$p.value,
  32. + conl = test$conf.int[1],
  33. + conh = test$conf.int[2]
  34. + )
  35. + return(out)
  36. + }
  37. > t=sapply(seq(ncol(t(biomarker))), function(x) f(t(biomarker)[,x], t(immune)[,x]))
  38.  
  39. str(t)
  40.  
  41. [list output truncated]
  42. - attr(*, "dim")= int [1:2] 5 719
  43. - attr(*, "dimnames")=List of 2
  44. ..$ : chr [1:5] "stat" "df" "pval" "conl" ...
  45. ..$ : NULL
  46. >
  47.  
  48.  
  49. > sapply(t, "[[", "pval")
  50. Error in FUN(X[[i]], ...) : subscript out of bounds
  51. >
  52.  
  53.  
  54. > pvalueGenes <- sapply(colnames(biomarker),function(i) t.test(biomarker[i, ],immune[i, ], paired = TRUE)$p.value)
  55. Error in if (stderr < 10 * .Machine$double.eps * abs(mx)) stop("data are essentially constant") :
  56. missing value where TRUE/FALSE needed
  57. In addition: Warning messages:
  58. 1: In mean.default(x) : argument is not numeric or logical: returning NA
  59. 2: In if (stderr < 10 * .Machine$double.eps * abs(mx)) stop("data are essentially constant") :
  60.  
  61. Show Traceback
  62.  
  63. Rerun with Debug
  64. Error in if (stderr < 10 * .Machine$double.eps * abs(mx)) stop("data are essentially constant") :
  65. missing value where TRUE/FALSE needed
  66.  
  67. pvalueGenes <- sapply(colnames(biomarker),
  68. function(i) t.test(biomarker[i, ],
  69. immune[i, ], paired = TRUE)$p.value)
  70.  
  71. names(pvalueGenes)[ pvalueGenes < 0.05 ]
Add Comment
Please, Sign In to add comment