Skip to main content

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

Project description

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.5.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

gtfparse-2.5.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gtfparse-2.5.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for gtfparse-2.5.0.tar.gz
Algorithm Hash digest
SHA256 9fea54811cd87f597a110a49dc1b1b6a3325ffb7d1f36ecc62c32d14d3eb9493
MD5 1f6071f804f1db17b731aad4d6b4032f
BLAKE2b-256 91e9f576f57742fe8fcb8086eb72c6de60e75e7adce7f6dc582d34b5143fb1ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gtfparse-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for gtfparse-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc9e9e77b7bdd90dda0e41da864714cb40b6b0c64ecc1d8a131e11497357140
MD5 e30b7402e8f082184dfd8c3a7fea3eb1
BLAKE2b-256 b14b0cb91cedef2b9e93f340166e8709587e3c36366fff4964973ff0d38908ba

See more details on using hashes here.

Supported by

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