Entering edit mode
3.8 years ago
Kira
•
0
Hi, I am learning how to convert gene ID to gene name, these are the code that I searched on the net:
get_map = function(input){
if(is.character(input)){
if(!file.exists(input)) stop("Bad input file.")
message("Treat input as file")
input = data.table::fread(input, header = F)
} else {
data.table::setDT(input)}
input = input[input[[3]] == "gene", ]
pattern_name = ".*gene_name \"([^;]+)\";.*"
gene_id = sub(pattern_id, "\\1", input[[9]])
gene_name = sub(pattern_name, "\\1", input[[9]])
I'm not quite understand the use of the " * " in front of " gene_name", and the whole thing behind it 【 \"([^;]+)\";.*"】
pattern_name = ".*gene_name \"([^;]+)\";.*"
Is there anyone could please explain to me ?
Hi, you can use
Annotationdbi
orbiomart
to convert gene ids to gene symbols. Check the following threads in Biostars.Ensembl ID to ENTREZ best converter
A: converting mouse emsembl gene IDs to Gene names by bioMart and gconvert with n
Thank you very much = )