| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: gtfparse |
| 3 |
Version: 1.3.0 |
| 4 |
Summary: GTF Parsing |
| 5 |
Home-page: https://github.com/openvax/gtfparse |
| 6 |
Author: Alex Rubinsteyn |
| 7 |
License: http://www.apache.org/licenses/LICENSE-2.0.html |
| 8 |
Classifier: Development Status :: 4 - Beta |
| 9 |
Classifier: Environment :: Console |
| 10 |
Classifier: Operating System :: OS Independent |
| 11 |
Classifier: Intended Audience :: Science/Research |
| 12 |
Classifier: License :: OSI Approved :: Apache Software License |
| 13 |
Classifier: Programming Language :: Python |
| 14 |
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics |
| 15 |
Description-Content-Type: text/markdown |
| 16 |
License-File: LICENSE |
| 17 |
|
| 18 |
[](https://travis-ci.org/openvax/gtfparse) [](https://coveralls.io/github/openvax/gtfparse?branch=master) |
| 19 |
<a href="https://pypi.python.org/pypi/gtfparse/"> |
| 20 |
<img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" /> |
| 21 |
</a> |
| 22 |
|
| 23 |
gtfparse |
| 24 |
======== |
| 25 |
Parsing tools for GTF (gene transfer format) files. |
| 26 |
|
| 27 |
# Example usage |
| 28 |
|
| 29 |
## Parsing all rows of a GTF file into a Pandas DataFrame |
| 30 |
|
| 31 |
```python |
| 32 |
from gtfparse import read_gtf |
| 33 |
|
| 34 |
# returns GTF with essential columns such as "feature", "seqname", "start", "end" |
| 35 |
# alongside the names of any optional keys which appeared in the attribute column |
| 36 |
df = read_gtf("gene_annotations.gtf") |
| 37 |
|
| 38 |
# filter DataFrame to gene entries on chrY |
| 39 |
df_genes = df[df["feature"] == "gene"] |
| 40 |
df_genes_chrY = df_genes[df_genes["seqname"] == "Y"] |
| 41 |
``` |
| 42 |
|
| 43 |
|
| 44 |
## Getting gene FPKM values from a StringTie GTF file |
| 45 |
|
| 46 |
```python |
| 47 |
from gtfparse import read_gtf |
| 48 |
|
| 49 |
df = read_gtf( |
| 50 |
"Transcripts.gtf", |
| 51 |
column_converters={"FPKM": float}) |
| 52 |
|
| 53 |
gene_fpkms = { |
| 54 |
gene_name: fpkm |
| 55 |
for (gene_name, fpkm, feature) |
| 56 |
in zip(df["seqname"], df["FPKM"], df["feature"]) |
| 57 |
if feature == "gene" |
| 58 |
} |
| 59 |
``` |
| 60 |
|
| 61 |
|