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.7.0.tar.gz (24.6 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.7.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gtfparse-2.7.0.tar.gz
Algorithm Hash digest
SHA256 a636b3952cebefa2b3d5a0639b3c59116c1ec6917658c78c7bb8483fdb69e0e3
MD5 87e24f0689b5a6aec6769cd7f962f84c
BLAKE2b-256 352dcabd5a72066c004c4eb58793c3ff186573e1804af1e8e9006c98ed0b08f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gtfparse-2.7.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1842ee70d258f5f69a87b9fb74b75b5ef71cbac94671f4cd79b24a6d0756f55c
MD5 43cf91ddb4ca5b1b28af2fc14be2277f
BLAKE2b-256 91eedff16b6c3cbf3e887b5b2e1ffc34046a43b63ab2ed5e65819cfb20c2fa53

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