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_transcript_transformer-2.5.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

gtfparse_transcript_transformer-2.5.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for gtfparse_transcript_transformer-2.5.0.tar.gz
Algorithm Hash digest
SHA256 cee74c7722bb1a25634edda8b87feee2270790cb2410cb0c0e9d83275d87e988
MD5 838c36808784a1e0fe01128724a85c8e
BLAKE2b-256 67fcca4c4b61e332da8a372b491fafc1f59a7672e7dbd8d96e9cb12b78a8a1a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gtfparse_transcript_transformer-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 437cd7ede611ba0eaa4b1a0522fd99d337574ee11702107f93733701f0b916d1
MD5 192ac76375c97b7d0abeb0c64f9546a3
BLAKE2b-256 e2c046e15b8928792ba4bae7cda641c42baf638b1ca94c6c1b6f3d4522eceb6d

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