Я выполняю анализ экспрессии гена в R и, следовательно, работаю с большим количеством данных. Я хочу применить модель Кокса к этим данным (249R на 23000 C), но когда я пытаюсь это сделать, я получаю сообщение об ошибке (Protect (): переполнение стека защиты). Я понимаю, что многие другие задавали этот вопрос, и я пытался использовать ответы на эти предыдущие вопросы, такие как параметры (выражения = 5e5), а также gl mnet, но последний дает мне ошибку (Ошибка в [.data.frame
(data, c (lhsVars, rhsVars)): выбраны неопределенные столбцы), и я не уверен, как его использовать при выполнении регрессии Кокса, и предыдущая опция не работает. Кроме того, учитывая то, как я работаю над своим проектом, я не могу разделить мой фрейм данных.
Я приложил свой код и был бы очень признателен за любую помощь! Извините, если мой код запутан - я студент, и мне еще многое предстоит узнать.
totranspose <- read.delim("/Users/menon/OneDrive/Desktop/csrsef files/FilesToTranspose.txt", stringsAsFactors = F, header = T)
rownames(totranspose) <- totranspose$X
totranspose$X <- NULL
finaldatacsrsef <- t(totranspose)
colnames(finaldatacsrsef) <- as.character(unlist(finaldatacsrsef[1,]))
finaldatacsrsef <- finaldatacsrsef[-1,]
library(survival)
initData <- data.frame(finaldatacsrsef)
eventfreetime <- initData[ , c("EFST")]
vitalstatus <- initData[ , c("Status")]
temporaryObj <- Surv(as.numeric(eventfreetime), vitalstatus == 2)
finalDataa <- data.frame(SurvObj = temporaryObj)
finalDataa <- cbind(finalDataa, initData[, 3:ncol(initData)])
options(expressions = 5e5)
finalcox <- coxph(SurvObj ~ ., data = finalDataa)
summary(finalcox)$coefficients
Спасибо!
Редактировать: Вот как выглядят мои данные (имена пациентов являются заголовками строк, имена генов являются заголовками столбцов)
> dput(initData[1:10, 1:10])
structure(list(EFST = structure(c(TARGET.30.PAAPFA = 166L, TARGET.30.PACLJN = 193L,
TARGET.30.PACRYY = 189L, TARGET.30.PACRZM = 233L, TARGET.30.PACSNL = 45L,
TARGET.30.PACSSR = 176L, TARGET.30.PACUGP = 141L, TARGET.30.PACVNB = 63L,
TARGET.30.PACYGY = 75L, TARGET.30.PACZPX = 194L), .Label = c(" 2.00000",
" 9.00000", "1002.00000", "1013.00000", "1022.00000", "1030.00000",
...
"165.00000", "1659.00000", "168.00000", "1696.00000", "1707.00000",
"1710.00000", "172.00000", "1749.00000", "1795.00000", "1836.00000",
"1843.00000", "1880.00000", "190.00000", "1933.00000", "1964.00000",
"2007.00000", "2025.00000", "203.00000", "205.00000", "206.00000",
"2147.00000", "2155.00000", "217.00000", "2183.00000", "219.00000",
...
"887.00000", "922.00000", "932.00000", "956.00000", "964.00000",
"968.00000"), class = "factor"), Status = structure(c(TARGET.30.PAAPFA = 4L,
TARGET.30.PACLJN = 1L, TARGET.30.PACRYY = 1L, TARGET.30.PACRZM = 4L,
TARGET.30.PACSNL = 4L, TARGET.30.PACSSR = 7L, TARGET.30.PACUGP = 4L,
TARGET.30.PACVNB = 4L, TARGET.30.PACYGY = 4L, TARGET.30.PACZPX = 1L
), .Label = c(" 1.00000", " 2.00000", " 1.00000", " 2.00000",
" 2.000000", " 1.00000", " 2.00000"), class = "factor"), AADACL3 = structure(c(TARGET.30.PAAPFA = 219L,
TARGET.30.PACLJN = 103L, TARGET.30.PACRYY = 83L, TARGET.30.PACRZM = 234L,
TARGET.30.PACSNL = 150L, TARGET.30.PACSSR = 247L, TARGET.30.PACUGP = 140L,
TARGET.30.PACVNB = 118L, TARGET.30.PACYGY = 227L, TARGET.30.PACZPX = 99L
), .Label = c(" 4.70471", " 4.71884", " 4.75278", " 4.77252",
" 4.79924", " 4.82726", " 4.83177", " 4.85297", " 4.85348",
...
" 5.74958", " 5.76020", " 5.77283", " 5.77490", " 5.79089",
" 5.91416", " 5.02643", " 5.16070", " 5.20377", " 5.33849",
" 5.43057", " 5.70252", " 5.88764"), class = "factor"), AADACL4 = structure(c(TARGET.30.PAAPFA = 201L,
TARGET.30.PACLJN = 104L, TARGET.30.PACRYY = 75L, TARGET.30.PACRZM = 213L,
TARGET.30.PACSNL = 112L, TARGET.30.PACSSR = 247L, TARGET.30.PACUGP = 170L,
TARGET.30.PACVNB = 199L, TARGET.30.PACYGY = 140L, TARGET.30.PACZPX = 30L
), .Label = c(" 4.37049", " 4.41956", " 4.56399", " 4.60298",
" 4.66085", " 4.66949", " 4.67545", " 4.69108", " 4.69205",
...
" 5.77346", " 4.84060", " 4.93969", " 5.01135", " 5.03256",
" 5.22472", " 5.29179", " 5.70923"), class = "factor"), ACADM = structure(c(TARGET.30.PAAPFA = 182L,
TARGET.30.PACLJN = 37L, TARGET.30.PACRYY = 86L, TARGET.30.PACRZM = 218L,
TARGET.30.PACSNL = 238L, TARGET.30.PACSSR = 241L, TARGET.30.PACUGP = 215L,
TARGET.30.PACVNB = 201L, TARGET.30.PACYGY = 131L, TARGET.30.PACZPX = 70L
), .Label = c(" 6.25757", " 6.33278", " 6.39292", " 6.61567",
" 6.70676", " 6.77349", " 6.82724", " 6.84948", " 6.88238",
" 7.03772", " 7.08124", " 7.11364", " 7.16697", " 7.21509",
" 7.21749", " 7.22232", " 7.22508", " 7.24340", " 7.26963",
" 7.27326", " 7.28288", " 7.29225", " 7.30015", " 7.31206",
….
" 7.94490", " 8.10245", " 8.15717"), class = "factor"), ACOT11 = structure(c(TARGET.30.PAAPFA = 211L,
TARGET.30.PACLJN = 25L, TARGET.30.PACRYY = 35L, TARGET.30.PACRZM = 176L,
TARGET.30.PACSNL = 196L, TARGET.30.PACSSR = 247L, TARGET.30.PACUGP = 156L,
TARGET.30.PACVNB = 186L, TARGET.30.PACYGY = 199L, TARGET.30.PACZPX = 63L
), .Label = c(" 5.93635", " 5.94244", " 5.95103", " 5.98901",
" 6.03946", " 6.11429", " 6.11859", " 6.13903", " 6.15869",
...
" 6.54330", " 6.58306", " 6.78981"), class = "factor"), ACOT7 = structure(c(TARGET.30.PAAPFA = 177L,
TARGET.30.PACLJN = 88L, TARGET.30.PACRYY = 15L, TARGET.30.PACRZM = 227L,
TARGET.30.PACSNL = 176L, TARGET.30.PACSSR = 243L, TARGET.30.PACUGP = 112L,
TARGET.30.PACVNB = 234L, TARGET.30.PACYGY = 190L, TARGET.30.PACZPX = 2L
), .Label = c(" 7.27372", " 7.44455", " 7.57713", " 7.63049",
" 7.67607", " 7.67940", " 7.67984", " 7.69863", " 7.74928",
" 7.79042", " 7.79045", " 7.79654", " 7.81007", " 7.83489",
" 7.83490", " 7.83660", " 7.85289", " 7.86943", " 7.87172",
" 7.87769", " 7.88242", " 7.89099", " 7.91394", " 7.91521",
" 7.91740", " 7.93080", " 7.93191", " 7.94568", " 7.96315",
" 7.97490", " 7.98972", " 7.99591", " 8.00916", " 8.01633",
" 8.02621", " 8.03156", " 8.03209", " 8.04701", " 8.05113",
" 8.05589", " 8.05917", " 8.06400", " 8.06733", " 8.08233",
" 8.10082", " 8.10544", " 8.11094", " 8.12160", " 8.13253",
" 8.13579", " 8.14512", " 8.14566", " 8.15169", " 8.15522",
" 8.15733", " 8.16079", " 8.16116", " 8.16126", " 8.16969",
" 8.17116", " 8.18370", " 8.20090", " 8.20675", " 8.20713",
" 8.21006", " 8.21736", " 8.21749", " 8.21878", " 8.24505",
" 8.24802", " 8.25781", " 8.27362", " 8.27436", " 8.27646",
" 8.28431", " 8.28967", " 8.29238", " 8.29331", " 8.29626",
" 8.31274", " 8.31330", " 8.31784", " 8.31881", " 8.32197",
" 8.34618", " 8.35837", " 8.37840", " 8.38011", " 8.38226",
" 8.38984", " 8.40466", " 8.44161", " 8.45682", " 8.46116",
" 8.49594", " 8.50602", " 8.52247", " 8.53077", " 8.55986",
" 8.57609", " 8.70593", " 8.78929", " 8.79241", " 8.83021",
" 8.88021", " 8.89001", " 8.90448", " 9.11322", " 9.43475",
" 7.52861", " 7.66466", " 7.68660", " 7.70969", " 7.71580",
" 7.72014", " 7.73900", " 7.73927", " 7.74026", " 7.75380",
" 7.75922", " 7.76969", " 7.77150", " 7.78116", " 7.78417",
" 7.79180", " 7.79952", " 7.80261", " 7.80837", " 7.81161",
" 7.81396", " 7.82174", " 7.82495", " 7.82584", " 7.82670",
" 7.83582", " 7.83650", " 7.85396", " 7.85827", " 7.87575",
" 7.88243", " 7.88348", " 7.88520", " 7.88999", " 7.90379",
" 7.91414", " 7.91715", " 7.93460", " 7.93812", " 7.96672",
" 7.97637", " 7.98229", " 7.98352", " 8.00525", " 8.01628",
" 8.01696", " 8.01744", " 8.01888", " 8.01977", " 8.02221",
" 8.02997", " 8.03639", " 8.04479", " 8.05963", " 8.07101",
" 8.07438", " 8.07717", " 8.08261", " 8.08476", " 8.09201",
" 8.09559", " 8.10024", " 8.10100", " 8.10383", " 8.10417",
" 8.11497", " 8.11502", " 8.11807", " 8.12097", " 8.12552",
" 8.13045", " 8.13261", " 8.13270", " 8.13377", " 8.13397",
" 8.13897", " 8.14309", " 8.14993", " 8.15376", " 8.15771",
" 8.17004", " 8.17409", " 8.17599", " 8.19405", " 8.20733",
" 8.21219", " 8.22061", " 8.23543", " 8.23934", " 8.24026",
" 8.24202", " 8.24563", " 8.26212", " 8.26387", " 8.26394",
" 8.27844", " 8.27997", " 8.29101", " 8.30884", " 8.31898",
" 8.32005", " 8.32071", " 8.32172", " 8.32829", " 8.32889",
" 8.33430", " 8.33625", " 8.34192", " 8.34423", " 8.36700",
" 8.37298", " 8.37877", " 8.39039", " 8.41815", " 8.42202",
" 8.42291", " 8.43199", " 8.43645", " 8.43953", " 8.48244",
" 8.49337", " 8.49969", " 8.52678", " 8.54624", " 8.55327",
" 8.57020", " 8.57290", " 8.66956", " 8.67772", " 8.78580",
" 9.096890", " 7.80377", " 7.84975", " 8.01090", " 8.18525",
" 8.22819", " 8.25531", " 8.47783"), class = "factor"), ACTB = structure(c(TARGET.30.PAAPFA = 139L,
TARGET.30.PACLJN = 93L, TARGET.30.PACRYY = 90L, TARGET.30.PACRZM = 218L,
TARGET.30.PACSNL = 164L, TARGET.30.PACSSR = 237L, TARGET.30.PACUGP = 211L,
TARGET.30.PACVNB = 230L, TARGET.30.PACYGY = 202L, TARGET.30.PACZPX = 37L
), .Label = c(" 10.29300", " 10.33920", " 10.37040", " 10.51230",
" 10.52510", " 10.55200", " 10.57640", " 10.60880", " 10.63620",
"10.84560", "10.85970", "11.00500", "11.11320"), class = "factor"),
ACTL8 = structure(c(TARGET.30.PAAPFA = 212L, TARGET.30.PACLJN = 73L,
TARGET.30.PACRYY = 24L, TARGET.30.PACRZM = 196L, TARGET.30.PACSNL = 151L,
TARGET.30.PACSSR = 247L, TARGET.30.PACUGP = 148L, TARGET.30.PACVNB = 124L,
TARGET.30.PACYGY = 236L, TARGET.30.PACZPX = 61L), .Label = c(" 5.24716",
" 5.37788", " 5.46886", " 5.52772", " 5.56753", " 5.57768",
...
" 6.69476"), class = "factor")), row.names = c("TARGET.30.PAAPFA",
"TARGET.30.PACLJN", "TARGET.30.PACRYY", "TARGET.30.PACRZM", "TARGET.30.PACSNL",
"TARGET.30.PACSSR", "TARGET.30.PACUGP", "TARGET.30.PACVNB", "TARGET.30.PACYGY",
"TARGET.30.PACZPX"), class = "data.frame")