BiomartException: Query ERROR for existing dataset in BioMart
0
0
Entering edit mode
16 days ago
Luqman • 0

I am trying to fetch protein sequences for a list of gene IDs using from BioMart API using the Python code:

def fetch_protein_sequences(gene_ids):
    dataset = Dataset(name='taestivum_eg_gene', host='http://plants.ensembl.org')
    # Fetch protein sequences
    response = dataset.query(
        attributes=[
            'ensembl_gene_id', 
            'peptide'
        ],
        filters={'gene_id': gene_ids}
    )
    return response

# Read gene IDs from file
with open('gene_ids.txt') as f:
    gene_ids = [line.strip() for line in f]

# Fetch protein sequences
protein_sequences = fetch_protein_sequences(gene_ids)

Bu keep getting the error message:

BiomartException: Query ERROR: caught BioMart::Exception::Usage: WITHIN Virtual Schema : default, Dataset taestivum_eg_gene NOT FOUND

Verified the existence of data taestivum_eg_gene, attributes and filter using:

server = Server(host='http://plants.ensembl.org')
for dataset in server.marts['plants_mart'].datasets:
    print(dataset)

Could someone please help me understand why I am seeing this error?

Thank you in advance!

biomart ensembl wheat python pybiomart • 352 views
ADD COMMENT
0
Entering edit mode

The dataset you want (taestivum_eg_gene) exists within the "plants_mart" schema, not the default schema. Your current code assumes the default schema.

The most straightforward fix is to explicitly tell the Dataset object to use the "plants_mart" schema

from biomart import BiomartServer, Dataset

def fetch_protein_sequences(gene_ids):
    server = BiomartServer("http://plants.ensembl.org")  # Connect to server
    # Specify the correct mart
    dataset = server.marts["plants_mart"].datasets["taestivum_eg_gene"]
ADD REPLY
0
Entering edit mode

I am using pybiomart which has Server inplace of BiomartServer, I used that as per above but still getting the same error. Also, when I am checking filters for the dataset it works and prints available filters, same for when checking attributes. Somehow the fetching function returns error.

ADD REPLY
0
Entering edit mode

Could share some examples for gene_ids?

ADD REPLY
0
Entering edit mode

Yes please see below:

TraesCS2B02G372900
TraesCS2B02G375100
TraesCS2B02G374700
TraesCS2B02G382000
ADD REPLY

Login before adding your answer.

Traffic: 1093 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