pybiomart error retrieving sequences
I'm new to pybiomart, and I'm trying to retrieve peptide sequences from a sequence dataset, but I get a BiomartException. Here's my code:
mart = server["ENSEMBL_MART_ENSEMBL"]
seq_mart = server["ENSEMBL_MART_SEQUENCE"]
seq_dataset = seq_mart["hsapiens_genomic_sequence"]
seq_dataset.query(attributes=["peptide"])
But this gives an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tiltwolf/.local/lib/python3.10/site-packages/pybiomart/dataset.py", line 266, in query
raise BiomartException(response.text)
pybiomart.base.BiomartException: Query ERROR: caught BioMart::Exception::Configuration: No Importable Recieved in GenomicSequence
What's going on?
• 1,409 views
•
link
1 answer
Try this:
from pybiomart import Server
server = Server(host='http://www.ensembl.org')
dataset = server.marts['ENSEMBL_MART_ENSEMBL']['hsapiens_gene_ensembl']
dataset.query(attributes=['ensembl_gene_id', 'peptide'],
filters={'chromosome_name': '1'})
You need to create an instance of the Server class and select your dataset. This example is only for the first chromosome, you can remove the filter.
• 0 views
•
link
Log in to answer this question.