Question: getSequence() biomaRt R function using plant ensembl mart
gravatar for gaby_santos
2.5 years ago by
gaby_santos10 wrote:

Hi! I want to retrieve the cdna sequences of Glycine max using the getSequence function but when I try I get this error:

Error in martCheck(mart, c("ensembl", "ENSEMBL_MART_ENSEMBL")) : 
  This function only works when used with the ensembl BioMart.This function only works when used with the ENSEMBL_MART_ENSEMBL BioMart.

My code is this:


#I define the soybean dataset using the plants_mart
ensembl_soybean = useMart(host="", "plants_mart", 
                          dataset = "gmax_eg_gene")

#As I want all the genes I filter according to the chromosome name, which I obtain it using this instruction
chrom = keys(ensembl_soybean, keytype = "chromosome_name") 

#I get soybean gene and transcripts info
Soybean_Seq_Info = getBM(attributes = c("ensembl_gene_id","ensembl_transcript_id",
                                        "external_gene_name"), filters = "chromosome_name",
                         values = chrom, mart = ensembl_soybean)

#I define an object of GenesIDs from the retrieved data

GenesID = unique(Soybean_Seq_Info$ensembl_gene_id)

#With the ensembl genes IDs I retrieve I want to get the cdna sequences, for a test I only use the first 10 genes
Soybean_Genes = getSequence(id = GenesID[1:10],
                            seqType = "cdna",

But then I get the error I showed at the beginning, how can I obtain the cdna sequences according to their ensembl gene ID?

R • 1.7k views
ADD COMMENTlink modified 12 months ago by yichangyuycy10 • written 2.5 years ago by gaby_santos10

For future reference: Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
Formatting bar

ADD REPLYlink written 2.5 years ago by genomax91k

Mmmm... I am afraid this means that you cannot use getSequence in a mart that is not ENSEMBL_MART_ENSEMBL, i.e. the first output of the command


You might find some workaround for this, but I wouldn't know how to do.

Maybe you will have to move to some other tools such as bedtools getfasta or gffread.

Other solutions can be found here, but none of them is through biomaRt, sorry.

ADD REPLYlink modified 2.5 years ago • written 2.5 years ago by Fabio Marroni2.6k
gravatar for yichangyuycy
12 months ago by
yichangyuycy10 wrote:

Hi I found you just need to add one command as below before you run getsequence:

ensembl_soybean@biomart <- 'ENSEMBL_MART_ENSEMBL'

ADD COMMENTlink written 12 months ago by yichangyuycy10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 801 users visited in the last hour