GTF Parsing
Project description
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_as_dataframe
# 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_as_dataframe("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_as_dict
gtf_dict = read_gtf_as_dict(
"stringtie-output.gtf",
column_converters={"FPKM": float})
gene_fpkms = {
gene_name: fpkm
for (gene_name, fpkm, feature)
in zip(gtf_dict["gene_name"], gtf_dict["FPKM"], gtf_dict["feature"])
if feature == "gene"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gtfparse-0.3.0.tar.gz
(13.5 kB
view details)
File details
Details for the file gtfparse-0.3.0.tar.gz.
File metadata
- Download URL: gtfparse-0.3.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e507ffef3bc0e123ece29cbebebaec9ebf7d408033b0d64b058e9dd00d1b2407
|
|
| MD5 |
b01c683c6b5ebd282d89f484ba578462
|
|
| BLAKE2b-256 |
bcc2e22d9cacb5083e6c5319996ce314c2c1deecd38d32702c3181a551ef6caf
|