I used the following package and code to get the uniprot ids and names of the proteins which my DE genes code for.

Library (mygene)
Genes <- c("AACS", "ACAA2", "ACADM", "ACLY", "ACOT8")
Protein_IDs <- queryMany(Genes, scopes = "symbol", 
                              fields = c("name", "uniprot",  "ensemblgene"), 
                              species = "human", as_dataframe = "True")

and then used

df1 <- data.frame(hmap_4$query)
df2 <- data.frame(hmap_4$name)
df3 <- data.frame(hmap_4$uniprot.Swiss.Prot)

to extract the info I wanted.

However, today the last line gave the following error

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 0, 1, 2

When I looked at the structure of Protein IDs (which has class DFrame) I noticed that while "query" and "name" are both of type character with 615 onservations, "uniprot.Swiss.Prot" is of type list with 615 entries.

Can anybody advise how I extract this list?

Source link