Skip to main content

entrez_utils

This library allows you to access information in remote Entrez databases from Python.

Examples

Creating an EntrezManager

An EntrezManager controls communication with the Entrez databases via HTTP requests. The class is aware of the methods supported by the Entrez API and ensures that the rate limits are not exceeded.

NCBI requests that the email address of the user be sent with requests, so an email is required to construct an EntrezManager.

from entrez_utils import EntrezManager

man = EntrezManager("foo@example.com")

Accessing a record

Most objects can be constructed with either an accession or an Entrez ID.

from entrez_utils import BioProject, BioSample, SRAExperiment, SRARun

project = BioProject(man, accession="PRJNA293777")
sample = BioSample(man, entrez_id="4009779")
experiment = SRAExperiment(man, accession="SRX4958339")
run = SRARun(man, accession="SRR8137396	")

Getting linked records

Properties of a record can be used to get other linked records. For example, this code gets the samples associated with a project.

samples = project.samples

Accessing raw XML

The Python objects representing Entrez records do not expose all possible data from the XML through their properties. The xml attribute give access to a parsed version of the raw XML associated with the record.

xml = project.xml

Batch fetching objects

The XML for a record is ordinarily retrieved lazily, but separately fetching XML for many records can be time consuming. To speed up the process, you can use fetch_all to fetch many records' XML at once.

samples = project.samples
fetch_all(samples)

The fetched function runs fetch_all on its argument and returns the argument, so it can be used to make the code above more concise.

samples = fetched(project.sample)

Metadata

Release files for entrez-utils 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for entrez-utils 0.0.3
File Size Uploaded Provenance Actions
entrez_utils-0.0.3.tar.gz 8.4 kB Without provenance Details for entrez_utils-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for entrez-utils 0.0.3
File Interpreter ABI Platform Actions
entrez_utils-0.0.3-py3-none-any.whl Python 3 none any Details for entrez_utils-0.0.3-py3-none-any.whl

Total release size: 18.1 kB

Release files / entrez_utils-0.0.3.tar.gz

Download URL entrez_utils-0.0.3.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
72d8bef2c0cfd779ec8c5a2f1a1f8ff11c055735b8e5e2b0932f2a0ef7316815
BLAKE2b-256 checksum
How to use checksums
37a139549c2a26488c38e55116e835d0cc37f5d93dce324a1cabad61c3e0b259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release files / entrez_utils-0.0.3-py3-none-any.whl

Download URL entrez_utils-0.0.3-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a18709a31dc464f6602d91b7a35c23e2c1d4eeb28384cf73abe7e1d093025a7
BLAKE2b-256 checksum
How to use checksums
6c4b63e5552913de2b3d180e745210c0f9182427dafbaa79aaa01bf89098efab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Security for entrez-utils 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page