5

I am experiencing an error while using getSequence() in biomaRt.

The code is given below:

library("biomaRt")
ensemblp <- useMart(biomart="plants_mart",host="plants.ensembl.org")
osj = useDataset("osativa_eg_gene", mart = ensemblp)
genes <- read.csv("osj.csv")
osj_id <- genes$ensembl_transcript_id

os_genes <- getSequence(id = osj_id, type = "ensembl_transcript_id", seqType = "peptide", mart = ensemblp)

The error message I am getting is :

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.

Did I make any mistake in code? Please help me fix the error. I tried asking this in Bioconductor support, but no one responded yet.

terdon
  • 10,071
  • 5
  • 22
  • 48
Learner
  • 51
  • 2
  • It doesn't seem to be a mistake in the code, but simply what you try to do isn't working in that BioMart – llrs Nov 07 '17 at 07:58
  • Did you find and review this post on bioconductor? Does it help you? https://support.bioconductor.org/p/74761/ – Bioathlete Nov 07 '17 at 20:05

2 Answers2

9

getSequence has only been enabled for the main Ensembl (vertebrates) biomaRt. This is all at the Bioconductor end. You'll need to use a getBM instead, for example:

os_genes <- getBM(attributes =c("ensembl_transcript_id", "peptide"), filters = "ensembl_transcript_id", values = osj_id, mart = osj)
llrs
  • 4,693
  • 1
  • 18
  • 42
Emily_Ensembl
  • 1,769
  • 7
  • 9
1

Biomart seems to be down most of the time so i think you can parse the ensemble ID and names from the annotation file which i did as i was having similar problem .

You can use this to make a file with ensemble ID and gene names for you use

awk '{                                
    for (i = 1; i <= NF; i++) {
        if ($i ~ /gene_id|gene_name/) {
            printf "%s ", $(i+1)
        }
    }
    print ""
}' Homo_sapiens.GRCh37.70.gtf | sed -e 's/"//g' -e 's/;//g' -e 's/ /\t/' | sort -k1,1 | uniq > Homo_sapiens.GRCh37.70.txt
kcm
  • 1,804
  • 12
  • 27