Hello,
I have another problem with biomaRt.
My ranked list of differentially expressed genes (ENSG...) are not ordered by the id number but by the expression fold change (naturally):
> library(biomaRt)
> mart <- useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl")
> list <- as.vector(testBiomaRt)
> list
V1
1 ENSG00000185247
2 ENSG00000268089
3 ENSG00000151136
4 ENSG00000054793
5 ENSG00000121895
6 ENSG00000172264
7 ENSG00000162409
8 ENSG00000142698
9 ENSG00000132109
10 ENSG00000140090
But after I used getBM function to get the gene names for the list:
> res <- getBM(attributes = c('ensembl_gene_id', 'external_gene_name'),
filters = 'ensembl_gene_id',
values = list,
mart = mart)
> res
the result is a list shuffled by the ranked ENSG number from lowest to highest:
ensembl_gene_id external_gene_name
1 ENSG00000054793 ATP9A
2 ENSG00000121895 TMEM156
3 ENSG00000132109 TRIM21
4 ENSG00000140090 SLC24A4
5 ENSG00000142698 C1orf94
6 ENSG00000151136 BTBD11
7 ENSG00000162409 PRKAA2
8 ENSG00000172264 MACROD2
9 ENSG00000185247 MAGEA11
10 ENSG00000268089 GABRQ
How can I maintain the original rank order of my input list in the output?
Thank you!