I've got a csv file with 2 columns - one of Entrez IDs and another of gene's measurement/fold-change. I am running code trying to use
gseKEGG(), getting the gene list prepared for that function like this:
d <-fread("file.csv") geneList <- d[,2] names(geneList) <- as.character(d[,1]) geneList <- sort(geneList, decreasing = TRUE) Error in `[.data.frame`(x, i) : undefined columns selected
I'm not sure how to work around this error as I can't see what I'm doing wrong here compared to the guidance given to complete this step for gseKEGG() - given here: https://github.com/YuLab-SMU/DOSE/wiki/how-to-prepare-your-own-geneList
What am I missing to get this working?
A snippet of what's in my csv file looks like this (there's no header):
107986084 0.809859097 100874369 0.913054347 100506380 0.423823357 100288797 0.369738668 100137049 0.798110485 100130742 0.78013134 723788 0.764999211 643136 0.231925398 641649 0.317150593 497258 0.754656732
I've also tried just putting a vector of the first column in, which allows me to use sort(), but this outputs:
kk2 <- gseKEGG(geneList = geneList, organism = kegg_organism, nPerm = 10000, minGSSize = 3, maxGSSize = 200, pvalueCutoff = 0.05, pAdjustMethod = "fdr", keyType = "ncbi-geneid") preparing geneSet collections... --> Expected input gene ID: 2990,3033,8802,219,131,160287 Error in check_gene_id(geneList, geneSets) : --> No gene can be mapped....