Skip to main content

GTF Parsing

Project description

Build Status Coverage Status

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(
    "stringtie-output.gtf",
    column_converters={"FPKM": float})

gene_fpkms = {
    gene_name: fpkm
    for (gene_name, fpkm, feature)
    in zip(df["gene_name"], 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-1.0.2.tar.gz (12.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: gtfparse-1.0.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gtfparse-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d20d06947ec39192115e580053c41707d3727da1d32fdfaec7d3e2b2de359ae1
MD5 ce3baa3c16d86fbcd1a1c89764b2292e
BLAKE2b-256 65bf8e93d92052c4b370dba17f114bc43f33abd6a8abdedcbfe93fd8440440f4

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