This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BiomaRT, retrieve exon positions but filter to chrosomal region

I am using biomart to retrieve gene/transcripts/exon information and I need exon start and end positions BUT before I need to filter according to the chromosome and the region.

ensembl=useMart("ensembl")
ensembl = useDataset("hsapiens_gene_ensembl",mart=ensembl)
filterlist <- list("7:128554168:128776507")
attributes = c("chromosome_name", "exon_chrom_start", "exon_chrom_end","transcript_length","strand", "ensembl_gene_id", "ensembl_transcript_id","ensembl_exon_id","hgnc_symbol")
results=getBM(attributes =attributes, filters = c("chromosomal_region"), values = filterlist, mart = ensembl)

It throws an error:

Query ERROR: caught BioMart::Exception::Usage: Attributes from multiple attribute pages are not allowed

Is it possible somehow to retrieve the exon positions in the defined chromosome and region?

r

1 answer

As Neilfws explains here, you are trying to query attributes from tables that are not linked. You will have to create two separate queries like this:

# attribute list without hgnc_symbol
attributes.1 = c("chromosome_name", "exon_chrom_start", "exon_chrom_end", "transcript_length","strand", "ensembl_gene_id",  "ensembl_transcript_id","ensembl_exon_id")
# attribute list with hgnc_symbol & ensembl_gene_id
attributes.2 = c("hgnc_symbol","ensembl_gene_id")

# get results for each query
results.1 = getBM(attributes = attributes.1, filters = c("chromosomal_region"), values = filterlist, mart = ensembl)
results.2 = getBM(attributes = attributes.2, filters = c("chromosomal_region"), values = filterlist, mart = ensembl)

# merge the results for both queries
results = merge(results.1,results.2,by='ensembl_gene_id',all.x=T)

The solution is great however, it takes amazingly much time to retrieve the data.

Log in to answer this question.