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.0.tar.gz (17.3 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.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gtfparse-2.6.0.tar.gz
  • Upload date:
  • Size: 17.3 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.0.tar.gz
Algorithm Hash digest
SHA256 d2682a6eb88682810ab6749962f6d14f040b28da709e37324fee316684460df1
MD5 65e10cf7fd7c1b6a32beb77e5eea8719
BLAKE2b-256 b39f0120261b5297373f8b1c0ddcc288e54e9abda2b7aee5e9c049effb5009ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gtfparse-2.6.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27c8ecbde9f5d6a8828a519bd8a66e0f10d90db35ee66c3633c9c393ae5dc3d8
MD5 93673da9a8ce0e01e8a589804574913c
BLAKE2b-256 139add6e159a94615a996056ffd50c1fd5423fe54040da726bbf8fa0dbae3934

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