Biomart, Sort Genes After Their Location On The Genome
1
0
Entering edit mode
10.8 years ago

Hi,

I am trying to retrive for a list of genes with their location on the chromosomes:

gene_locations<-getBM(attributes = c("ensembl_gene_id","chromosome_name", "start_position", "end_position"), filters='ensembl_gene_id', values = combined_cells_genes, mart = ens)

Now I would like to sort this list after their location on the genome (sort after chromosome + start position). Is there any straightforward way to do that within biomart, without having me to sort them with my own R code?

Thanks in advance, T

biomart • 3.3k views
ADD COMMENT
0
Entering edit mode
10.8 years ago

Okay this was not a very smart questions.

Basically I have used gene_locations [order(gene_locations[, 2], gene_locations[, 3]),] to order them, the only thing is they are order lexically rather than numerically, so will have to circumvent this somehow.

ADD COMMENT
2
Entering edit mode

To fix the lexical rather than numeric chromosome sorting, you would have to convert the chromosome_name column to a factor with the levels in the desired order:

ADD REPLY
0
Entering edit mode

Remember that R is 1-indexed, so you are probably ordering them by chromosome_name and start_position.

ADD REPLY
0
Entering edit mode

yes, that is what I do. thx

ADD REPLY

Login before adding your answer.

Traffic: 1507 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6