It will take very long time do this, any short method pls.
How to add or input nearly 8000 genes for annotation in enrichR.
This is command below
library(enrichR)
dbs <- listEnrichrDbs()
dbs <- c("GO_Molecular_Function_2015", "GO_Cellular_Component_2015", "GO_Biological_Process_2015" , "ChEA_2016" ,"KEGG_2016")
enriched <- enrichr(c("Runx1", "Gfi1", "Gfi1b", "Spi1", "Gata1", "Kdr"), dbs)
printEnrich(enriched, "output.txt" , sep = "\t", columns = c(1:9))
bp <- enriched[["GO_Biological_Process_2015"]]
But I want to enter 8000 genes for enrichment, how to do that.
1 answer
Put your genes in a vector: my_vec <- c("Gene1", "Gene2", ..., "Gene8000"). Then you can run enriched <- enrichr(my_vec, dbs)
How do you currently have your gene names?
I have in excel file.
Save them as a delimited file (csv/tsv) and read the file in R using , create a vector from the dataframe.
Starting point: http://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html
I am new to R, please can you explain me stepwise how to do that. I have tried the given command but it gets an error.
read.csv(Gene, header = TRUE, sep = ",", quote = "\"", + dec = ".", fill = TRUE, comment.char = "", ...)
Error: '...' used in an incorrect context
- Save the excel file as a csv file on excel (e.g. as "my_file.csv")
- In R, read them into a vector with
my_genes <- read.csv("my_file.csv") - Run
enriched <- enrichr(my_genes, dbs)
Getting an error
enriched <- enrichr(my_genes, dbs)
Uploading data to Enrichr... Error in `[.data.frame`(genes, , 2) : undefined columns selected
try enriched <- enrichr(my_genes[, 1], dbs)
Getting new error
Warning message:
In enrichr(my_genes[, 1], dbs) :
genes must be a vector of gene names or a dataframe with genes and score.
> printEnrich(enriched, "output.txt" , sep = "\t", columns = c(1:9))
Error in `[.data.frame`(data[[i]], 1:n, columns, drop = FALSE) :
undefined columns selected
Plese, Reply..... it's a humble request from my side. I have to submit my assignment.
You'll learn a lot from that assignment by having someone else do your work.
Google Convert a column to character vector in R and follow results you will be able to convert your data to a character vector, then it works.
I had googled it, but I couldn't find any appropriate answer, each time I get an error.
what is the output of head(my_genes) ?
1 AA878126
2 LUZP2
3 RRAD
4 BM547196
5 GFRA1
6 A_24_P230195
Really? It shouldn't be like that in R. Did you run above command from R?
Okay, prepare a text file with one gene per line and read into R.
dat=read.delim("geneList.txt", header=FALSE)
my_genes=as.character(dat$V1)
# run enrichr ...
Still getting an error.
> dat=read.delim("Up_Treated1.txt", header=FALSE)
> my_genes=as.character(dat$V1)
> enriched <- enrichr(dat, dbs)
Uploading data to Enrichr... Error in `[.data.frame`(genes, , 2) : undefined columns selected
> printEnrich(enriched, "output.txt" , sep = "\t", columns = c(1:9))
Error in printEnrich(enriched, "output.txt", sep = "\t", columns = c(1:9)) :
object 'enriched' not found
Don't get me wrong but pay attention to the code & error and which objects you are using as input for functions.
Here you should use my_genes with enrichr function. What did you think of the purpose behind my_genes=as.character(dat$V1) ? You are still using the dat object with enrichr function.
Thankx a lot for helping me..all..finally no errors.
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.

If I had an Entrez id than how to convert into vector form in text format. In the above query i had used chrachter form but when i am using it in numeric form it showing error.
my_genes <- c("11171", "8243", "112464", "2194", "9318", "79026", "1654", "65003", "6240", "3476", "6238", "3836", "4176", "1017", "249")
Command-
dat=read.delim("EntrezID.txt", header=FALSE)
my_genes=as.numeric(dat$V1)
de <- names( my_genes)[abs( my_genes) > 1.5]
head(de)
NULL
Do us all a favor (including yourself) and follow some R tutorials.
If I had enough time to search and learn various tutorial than I could have done it previously, anyone knows the answer then please tell me.
If I had enough time to search and learn various tutorial than I could have done it previously, anyone knows the answer then please tell me.
o_O
So you must be thinking people here have nothing important to do and just passing time. Good way to ask for help buddy!
If you're not willing to invest effort, bikash2510, no one else will be willing to help you. You do not seem to understand etiquette followed in open science forums. I'd recommend you put some time into learning and be careful with that attitude.
I will be monitoring your future posts for etiquette as well as evidence of effort invested.
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

Log in to answer this question.
I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Actually, i am new to R, what you are saying I am not getting it. :(
Wouter's statement has nothing to do with R. It's a short primer on how to format your post. You can read the posts under https://biostars.org/t/how-to to learn how to use the site better.
Hello bikash2510!
We believe that this post does not fit the main topic of this site.
Issue Resolved.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
There is no need to close a question if it's resolved, I reopened the thread.
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.