Unassigned list

Asked

Viewed 57 times

1

I intend to associate a column of Ids to their name. I mean, in each line of IDS I have a list of genes. and to that list of genes I want to associate the names of the genes. Here is my code:

geneIDS<- Cas1_go_BP2[, 6] #vector with the IDS

allgencNames<- vector(length = length(geneIDS))

for (i in 1:length(geneIDS)) {
  geneIDS_split<- unlist(strsplit(as.character(geneIDS[i]), ","))
  geneIDs_split2<-as.character(gsub(" ", "", as.character(geneIDS_split))) 
  geneNames_split2<-DEG_ID[match(geneIDs_split2, DEG_ID[,2]), 1]
  geneNames<- paste(geneNames_split2, collapse = ",")
  allgencNames[i]<- geneNames
}


all_go_BP<- cbind(Cas1_go_BP, geneNames)
  • 2

    Welcome to Stackoverflow Brasil! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please, take a look at this link and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.

  • Your question is confused, but it looks like a problem that can be solved with the function merge().

  • Good morning, I’ve solved the problem, thank you

  • @Sofia then answer yourself with the solution and close the question!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.