Skip to main content

Fast Cython-backed parsing for GTF attribute columns.

Project description

gtfreader

gtfreader is a small package for parsing and reading GTF files into pandas dataframes.

Requires Python 3.12 or newer.

Install

python -m pip install -e .

Usage

from gtfreader import read_gtf, read_gtf_python

df = read_gtf("annotation.gtf")
df_python = read_gtf_python("annotation.gtf")

read_gtf(...) uses the compiled parser path when available. read_gtf_python(...) uses the high-level pure Python parser path used by the current pyrunges reader style.

If you want to use the compiled low-level parser directly, pass it raw attribute strings from column 9 of the GTF before they have been expanded:

import pandas as pd

from gtfreader import find_first_data_line_index, parse_chunk_columns

skiprows = find_first_data_line_index("annotation.gtf")
attribute_lines = pd.read_csv(
    "annotation.gtf",
    sep="\t",
    header=None,
    usecols=[8],
    names=["Attribute"],
    comment="#",
    skiprows=skiprows,
)["Attribute"].tolist()

compiled_columns = parse_chunk_columns(attribute_lines)

Build

python -m build

Test

python -m pytest -q

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

gtfreader-0.1.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distributions

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

gtfreader-0.1.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (247.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

gtfreader-0.1.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (177.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file gtfreader-0.1.2.tar.gz.

File metadata

  • Download URL: gtfreader-0.1.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gtfreader-0.1.2.tar.gz
Algorithm Hash digest
SHA256 81b0b1902cb459619e68a7575f8826e9dea21f131a04c6711b204b68abac2f44
MD5 49b91d22bac4f3117b58542b32cb6885
BLAKE2b-256 7ede8f1bede49dade2cbd3add8357e77f500caa53757b3835006e2db7b884b4c

See more details on using hashes here.

File details

Details for the file gtfreader-0.1.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtfreader-0.1.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c3f9ef1d3d2441ec81bb49c605c42c529ad5f879388c4be0f41ab3654ac10e9
MD5 d7836be2565c3407847465a2f6667e15
BLAKE2b-256 bf4832dc5749c979554e281307d30c3dc87d28d1bf00710c227ecb91c7ce5052

See more details on using hashes here.

File details

Details for the file gtfreader-0.1.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gtfreader-0.1.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb174372104b756f55caca6cb0a41272ff93d7feaf1b3213a6ccdcc5bce19d30
MD5 bbb1a3139165253964fd540c34d1a4ee
BLAKE2b-256 1a222350c627364d2883d3ec38a4d42df0d88dc37572e9f6f0f497d867f6fb3f

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