Skip to main content

GTF Parsing

Project description

Temporary fix for gtfparse to work with polars>0.16, based on https://github.com/y9c/gtfparse

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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for gtfparse_transcript_transformer-2.0.2.tar.gz
Algorithm Hash digest
SHA256 4810b8554db3b2e89506f967ae0857b6087f81f187b9c0fce55671f312978115
MD5 2b6e1beb1a3ecf9eb1c34cdc2ce87707
BLAKE2b-256 8db87dbc0f56484cb0e2c02347b32b9b2c7b797919f30f611ade4fc3959d159b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gtfparse_transcript_transformer-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc06281f6c6e5cea303ec6c3f38127d1252401294f876feb4fdba928c3a362c7
MD5 01be3d00121adbc90d9a42c144b51c0d
BLAKE2b-256 1356bc6dcedae65418626fb8d79a8636c81d43c5903211abdc5b68c8c83964bf

See more details on using hashes here.

Supported by

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