Skip to main content

Parsing library for extracting data frames of genomic features from GTF files

Project description

Tests Coverage Status PyPI

gtfparse

Parsing tools for GTF (gene transfer format) files.

Example usage

Parsing all rows of a GTF file into a Pandas DataFrame

from gtfparse import read_gtf

# returns GTF with essential columns such as "feature", "seqname", "start", "end"
# alongside the names of any optional keys which appeared in the attribute column
df = read_gtf("gene_annotations.gtf")

# filter DataFrame to gene entries on chrY
df_genes = df[df["feature"] == "gene"]
df_genes_chrY = df_genes[df_genes["seqname"] == "Y"]

Getting gene FPKM values from a StringTie GTF file

from gtfparse import read_gtf

df = read_gtf(
    "Transcripts.gtf",
    column_converters={"FPKM": float})

gene_fpkms = {
    gene_name: fpkm
    for (gene_name, fpkm, feature)
    in zip(df["seqname"], df["FPKM"], df["feature"])
    if feature == "gene"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtfparse-2.6.2.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gtfparse-2.6.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file gtfparse-2.6.2.tar.gz.

File metadata

  • Download URL: gtfparse-2.6.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for gtfparse-2.6.2.tar.gz
Algorithm Hash digest
SHA256 266438ad6baf2336fed0d121d2bc8811aa8db02783d8a3e6a3b50992ac79c5d1
MD5 42257823813c1edc82a94a00269fabdf
BLAKE2b-256 c107ad99f3f069660168cb056f9965f3674a0e626b050afb8e5dcce3683cb30c

See more details on using hashes here.

File details

Details for the file gtfparse-2.6.2-py3-none-any.whl.

File metadata

  • Download URL: gtfparse-2.6.2-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for gtfparse-2.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 958e4f68cc9894190ca464c91b7701957c19e115f3835d2d165169deea270760
MD5 bdabecb6ac5e34e1ace348d8d527bf52
BLAKE2b-256 a04d8f203bc2199efc1b4151fdfbb5a8f9f179f0f95dc073cf056d70db489549

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page