gtfparse 3.0.2__tar.gz → 3.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. gtfparse-3.0.5/PKG-INFO +101 -0
  2. gtfparse-3.0.5/README.md +68 -0
  3. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/compare_releases.py +2 -2
  4. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/__init__.py +1 -1
  5. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/attribute_parsing.py +5 -2
  6. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/create_missing_features.py +5 -2
  7. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/write_gtf.py +2 -2
  8. gtfparse-3.0.5/gtfparse.egg-info/PKG-INFO +101 -0
  9. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse.egg-info/SOURCES.txt +0 -1
  10. {gtfparse-3.0.2 → gtfparse-3.0.5}/pyproject.toml +5 -5
  11. gtfparse-3.0.2/PKG-INFO +0 -157
  12. gtfparse-3.0.2/README.md +0 -124
  13. gtfparse-3.0.2/gtfparse.egg-info/PKG-INFO +0 -157
  14. {gtfparse-3.0.2 → gtfparse-3.0.5}/LICENSE +0 -0
  15. {gtfparse-3.0.2 → gtfparse-3.0.5}/MANIFEST.in +0 -0
  16. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/README.md +0 -0
  17. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/compare_readers.py +0 -0
  18. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/optimization-results.json +0 -0
  19. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/optimization.md +0 -0
  20. {gtfparse-3.0.2 → gtfparse-3.0.5}/benchmarks/results.json +0 -0
  21. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/_polars.py +0 -0
  22. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/_read_csv.py +0 -0
  23. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/parsing_error.py +0 -0
  24. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse/read_gtf.py +0 -0
  25. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse.egg-info/dependency_links.txt +0 -0
  26. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse.egg-info/requires.txt +0 -0
  27. {gtfparse-3.0.2 → gtfparse-3.0.5}/gtfparse.egg-info/top_level.txt +0 -0
  28. {gtfparse-3.0.2 → gtfparse-3.0.5}/lint.sh +0 -0
  29. {gtfparse-3.0.2 → gtfparse-3.0.5}/requirements.txt +0 -0
  30. {gtfparse-3.0.2 → gtfparse-3.0.5}/setup.cfg +0 -0
  31. {gtfparse-3.0.2 → gtfparse-3.0.5}/test.sh +0 -0
  32. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/__init__.py +0 -0
  33. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/B16.stringtie.head.gtf +0 -0
  34. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/ensembl_grch37.head.gtf +0 -0
  35. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/ensembl_grch37.head.gtf.gz +0 -0
  36. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/gencode.head.gtf +0 -0
  37. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/gencode.real.head.gtf +0 -0
  38. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data/refseq.ucsc.small.gtf +0 -0
  39. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/data.py +0 -0
  40. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_attribute_optimization.py +0 -0
  41. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_attribute_values.py +0 -0
  42. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_create_missing_features.py +0 -0
  43. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_ensembl_gtf.py +0 -0
  44. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_expand_attribute_column_false.py +0 -0
  45. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_expand_attributes.py +0 -0
  46. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_gencode_gtf.py +0 -0
  47. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_multiple_values_for_tag_attribute.py +0 -0
  48. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_parse_gtf_lines.py +0 -0
  49. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_polars_compatibility.py +0 -0
  50. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_progress.py +0 -0
  51. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_read_stringtie_gtf.py +0 -0
  52. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_reader.py +0 -0
  53. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_refseq_gtf.py +0 -0
  54. {gtfparse-3.0.2 → gtfparse-3.0.5}/tests/test_write_gtf.py +0 -0
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: gtfparse
3
+ Version: 3.0.5
4
+ Summary: Parsing library for extracting data frames of genomic features from GTF files
5
+ Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/openvax/gtfparse
8
+ Project-URL: Bug Tracker, https://github.com/openvax/gtfparse/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pyarrow>=18.0.0
24
+ Requires-Dist: pandas>=2.2.2
25
+ Provides-Extra: polars
26
+ Requires-Dist: polars>=0.20.31; extra == "polars"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: pytest-cov; extra == "dev"
30
+ Requires-Dist: ruff; extra == "dev"
31
+ Requires-Dist: coveralls; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
35
+ [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
36
+ <a href="https://pypi.python.org/pypi/gtfparse/">
37
+ <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
38
+ </a>
39
+
40
+ gtfparse
41
+ ========
42
+ Read GTF (gene transfer format) annotations into a pandas DataFrame, with one
43
+ row per feature and attribute values such as gene and transcript IDs expanded
44
+ into columns.
45
+
46
+ ## Install
47
+
48
+ ```sh
49
+ python -m pip install gtfparse
50
+ ```
51
+
52
+ Python 3.11 or later is required. For optional Polars output, install
53
+ `gtfparse[polars]`.
54
+
55
+ ## Read an annotation and find genes
56
+
57
+ This small artificial GTF runs without a download. Replace the stream with
58
+ your annotation filename when working with a real dataset.
59
+
60
+ ```python
61
+ from io import StringIO
62
+ from gtfparse import read_gtf
63
+
64
+ annotation = StringIO(
65
+ '1\texample\tgene\t101\t200\t.\t+\t.\tgene_id "g1"; gene_name "EXAMPLE";\n'
66
+ '1\texample\texon\t101\t150\t.\t+\t.\tgene_id "g1"; transcript_id "t1";\n'
67
+ )
68
+ features = read_gtf(annotation)
69
+ genes = features.loc[features["feature"] == "gene"]
70
+ print(genes["gene_name"].tolist())
71
+ for row in features.itertuples():
72
+ print(row.feature, row.seqname, row.start, row.end, row.gene_id)
73
+ ```
74
+
75
+ ```text
76
+ ['EXAMPLE']
77
+ gene 1 101 200 g1
78
+ exon 1 101 150 g1
79
+ ```
80
+
81
+ `feature` identifies the row type. `seqname` is the chromosome or contig name;
82
+ it is not the gene ID. The ninth GTF field supplies attributes such as
83
+ `gene_id`, `gene_name` and `transcript_id`.
84
+
85
+
86
+ <a id="version-3-migration"></a>
87
+ <a id="reporting-parsing-progress"></a>
88
+ <a id="example-usage"></a>
89
+ <a id="parsing-all-rows-of-a-gtf-file-into-a-pandas-dataframe"></a>
90
+ <a id="getting-gene-fpkm-values-from-a-stringtie-gtf-file"></a>
91
+
92
+ ## Documentation
93
+
94
+ - [Filter features, select chromosomes, write GTF and read numeric attributes](docs/guides/annotations.md)
95
+ - [Progress callbacks](docs/guides/progress.md)
96
+ - [Version 3 migration and optional Polars output](docs/guides/migration.md)
97
+ - [Complete API reference](docs/reference.md)
98
+
99
+ To build the documentation locally, run
100
+ `python -m pip install -r requirements-docs.txt` and `./docs.sh`.
101
+ `python scripts/check_docs_examples.py` checks the printed example output.
@@ -0,0 +1,68 @@
1
+ [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
2
+ [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
3
+ <a href="https://pypi.python.org/pypi/gtfparse/">
4
+ <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
5
+ </a>
6
+
7
+ gtfparse
8
+ ========
9
+ Read GTF (gene transfer format) annotations into a pandas DataFrame, with one
10
+ row per feature and attribute values such as gene and transcript IDs expanded
11
+ into columns.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ python -m pip install gtfparse
17
+ ```
18
+
19
+ Python 3.11 or later is required. For optional Polars output, install
20
+ `gtfparse[polars]`.
21
+
22
+ ## Read an annotation and find genes
23
+
24
+ This small artificial GTF runs without a download. Replace the stream with
25
+ your annotation filename when working with a real dataset.
26
+
27
+ ```python
28
+ from io import StringIO
29
+ from gtfparse import read_gtf
30
+
31
+ annotation = StringIO(
32
+ '1\texample\tgene\t101\t200\t.\t+\t.\tgene_id "g1"; gene_name "EXAMPLE";\n'
33
+ '1\texample\texon\t101\t150\t.\t+\t.\tgene_id "g1"; transcript_id "t1";\n'
34
+ )
35
+ features = read_gtf(annotation)
36
+ genes = features.loc[features["feature"] == "gene"]
37
+ print(genes["gene_name"].tolist())
38
+ for row in features.itertuples():
39
+ print(row.feature, row.seqname, row.start, row.end, row.gene_id)
40
+ ```
41
+
42
+ ```text
43
+ ['EXAMPLE']
44
+ gene 1 101 200 g1
45
+ exon 1 101 150 g1
46
+ ```
47
+
48
+ `feature` identifies the row type. `seqname` is the chromosome or contig name;
49
+ it is not the gene ID. The ninth GTF field supplies attributes such as
50
+ `gene_id`, `gene_name` and `transcript_id`.
51
+
52
+
53
+ <a id="version-3-migration"></a>
54
+ <a id="reporting-parsing-progress"></a>
55
+ <a id="example-usage"></a>
56
+ <a id="parsing-all-rows-of-a-gtf-file-into-a-pandas-dataframe"></a>
57
+ <a id="getting-gene-fpkm-values-from-a-stringtie-gtf-file"></a>
58
+
59
+ ## Documentation
60
+
61
+ - [Filter features, select chromosomes, write GTF and read numeric attributes](docs/guides/annotations.md)
62
+ - [Progress callbacks](docs/guides/progress.md)
63
+ - [Version 3 migration and optional Polars output](docs/guides/migration.md)
64
+ - [Complete API reference](docs/reference.md)
65
+
66
+ To build the documentation locally, run
67
+ `python -m pip install -r requirements-docs.txt` and `./docs.sh`.
68
+ `python scripts/check_docs_examples.py` checks the printed example output.
@@ -11,7 +11,7 @@ import os
11
11
  import statistics
12
12
  import subprocess
13
13
  import sys
14
- from datetime import datetime, timezone
14
+ from datetime import UTC, datetime
15
15
  from pathlib import Path
16
16
 
17
17
 
@@ -120,7 +120,7 @@ def main():
120
120
  )
121
121
  result = {
122
122
  "description": "Complete production readers; imports/checksums outside wall time; sequential fresh processes",
123
- "date": datetime.now(timezone.utc).isoformat(),
123
+ "date": datetime.now(UTC).isoformat(),
124
124
  "threads": args.threads,
125
125
  "inputs": {
126
126
  path.name: {
@@ -24,7 +24,7 @@ from .read_gtf import (
24
24
  )
25
25
  from .write_gtf import write_gtf
26
26
 
27
- __version__ = "3.0.2"
27
+ __version__ = "3.0.5"
28
28
 
29
29
  __all__ = [
30
30
  "GENCODE_BIOTYPE_ALIASES",
@@ -56,8 +56,11 @@ def expand_attribute_strings(
56
56
  the start, every 10,000 rows, and at completion. An empty input emits
57
57
  one ``("attributes", 0, 0)`` event. Callback exceptions propagate.
58
58
 
59
- Returns OrderedDict of column->value list mappings, in the order they
60
- appeared in the attribute strings.
59
+ Returns
60
+ -------
61
+ collections.OrderedDict
62
+ Column-to-value-list mappings, in the order the columns appeared in
63
+ the attribute strings.
61
64
  """
62
65
  n = len(attribute_strings)
63
66
 
@@ -44,8 +44,11 @@ def create_missing_features(dataframe, unique_keys={}, extra_columns={}, missing
44
44
  missing_value : any
45
45
  Which value to fill in for columns that we don't infer values for.
46
46
 
47
- Returns original dataframe (converted to Pandas if necessary) along with all
48
- extra rows created for missing features.
47
+ Returns
48
+ -------
49
+ pandas.DataFrame
50
+ Original rows (converted to pandas if necessary) together with the
51
+ extra rows created for missing features.
49
52
  """
50
53
  if hasattr(dataframe, "to_pandas"):
51
54
  dataframe = dataframe.to_pandas()
@@ -16,7 +16,7 @@ import sys
16
16
  from collections.abc import Iterable
17
17
  from itertools import repeat
18
18
  from pathlib import Path
19
- from typing import TYPE_CHECKING, Optional, Union
19
+ from typing import TYPE_CHECKING, Union
20
20
 
21
21
  import pandas as pd
22
22
 
@@ -74,7 +74,7 @@ def _lines(df):
74
74
  def write_gtf(
75
75
  df: Union[pd.DataFrame, "polars.DataFrame"],
76
76
  path: Union[str, Path],
77
- header_lines: Optional[Iterable[str]] = None,
77
+ header_lines: Iterable[str] | None = None,
78
78
  ) -> None:
79
79
  """
80
80
  Write a DataFrame of genomic features back out to a GTF file.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: gtfparse
3
+ Version: 3.0.5
4
+ Summary: Parsing library for extracting data frames of genomic features from GTF files
5
+ Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/openvax/gtfparse
8
+ Project-URL: Bug Tracker, https://github.com/openvax/gtfparse/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pyarrow>=18.0.0
24
+ Requires-Dist: pandas>=2.2.2
25
+ Provides-Extra: polars
26
+ Requires-Dist: polars>=0.20.31; extra == "polars"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: pytest-cov; extra == "dev"
30
+ Requires-Dist: ruff; extra == "dev"
31
+ Requires-Dist: coveralls; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
35
+ [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
36
+ <a href="https://pypi.python.org/pypi/gtfparse/">
37
+ <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
38
+ </a>
39
+
40
+ gtfparse
41
+ ========
42
+ Read GTF (gene transfer format) annotations into a pandas DataFrame, with one
43
+ row per feature and attribute values such as gene and transcript IDs expanded
44
+ into columns.
45
+
46
+ ## Install
47
+
48
+ ```sh
49
+ python -m pip install gtfparse
50
+ ```
51
+
52
+ Python 3.11 or later is required. For optional Polars output, install
53
+ `gtfparse[polars]`.
54
+
55
+ ## Read an annotation and find genes
56
+
57
+ This small artificial GTF runs without a download. Replace the stream with
58
+ your annotation filename when working with a real dataset.
59
+
60
+ ```python
61
+ from io import StringIO
62
+ from gtfparse import read_gtf
63
+
64
+ annotation = StringIO(
65
+ '1\texample\tgene\t101\t200\t.\t+\t.\tgene_id "g1"; gene_name "EXAMPLE";\n'
66
+ '1\texample\texon\t101\t150\t.\t+\t.\tgene_id "g1"; transcript_id "t1";\n'
67
+ )
68
+ features = read_gtf(annotation)
69
+ genes = features.loc[features["feature"] == "gene"]
70
+ print(genes["gene_name"].tolist())
71
+ for row in features.itertuples():
72
+ print(row.feature, row.seqname, row.start, row.end, row.gene_id)
73
+ ```
74
+
75
+ ```text
76
+ ['EXAMPLE']
77
+ gene 1 101 200 g1
78
+ exon 1 101 150 g1
79
+ ```
80
+
81
+ `feature` identifies the row type. `seqname` is the chromosome or contig name;
82
+ it is not the gene ID. The ninth GTF field supplies attributes such as
83
+ `gene_id`, `gene_name` and `transcript_id`.
84
+
85
+
86
+ <a id="version-3-migration"></a>
87
+ <a id="reporting-parsing-progress"></a>
88
+ <a id="example-usage"></a>
89
+ <a id="parsing-all-rows-of-a-gtf-file-into-a-pandas-dataframe"></a>
90
+ <a id="getting-gene-fpkm-values-from-a-stringtie-gtf-file"></a>
91
+
92
+ ## Documentation
93
+
94
+ - [Filter features, select chromosomes, write GTF and read numeric attributes](docs/guides/annotations.md)
95
+ - [Progress callbacks](docs/guides/progress.md)
96
+ - [Version 3 migration and optional Polars output](docs/guides/migration.md)
97
+ - [Complete API reference](docs/reference.md)
98
+
99
+ To build the documentation locally, run
100
+ `python -m pip install -r requirements-docs.txt` and `./docs.sh`.
101
+ `python scripts/check_docs_examples.py` checks the printed example output.
@@ -24,7 +24,6 @@ gtfparse.egg-info/SOURCES.txt
24
24
  gtfparse.egg-info/dependency_links.txt
25
25
  gtfparse.egg-info/requires.txt
26
26
  gtfparse.egg-info/top_level.txt
27
- gtfparse/../requirements.txt
28
27
  tests/__init__.py
29
28
  tests/data.py
30
29
  tests/test_attribute_optimization.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gtfparse"
7
- requires-python = ">=3.9"
7
+ requires-python = ">=3.11"
8
8
  authors = [ {name="Alex Rubinsteyn", email="alex.rubinsteyn@unc.edu" } ]
9
9
  description = "Parsing library for extracting data frames of genomic features from GTF files"
10
10
  license = "Apache-2.0"
@@ -16,10 +16,10 @@ classifiers = [
16
16
  "Intended Audience :: Science/Research",
17
17
  "Programming Language :: Python",
18
18
  "Programming Language :: Python :: 3",
19
- "Programming Language :: Python :: 3.9",
20
- "Programming Language :: Python :: 3.10",
21
19
  "Programming Language :: Python :: 3.11",
22
20
  "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
23
  "Topic :: Scientific/Engineering :: Bio-Informatics",
24
24
  ]
25
25
  readme = "README.md"
@@ -46,7 +46,7 @@ dependencies = {file = ["requirements.txt"]}
46
46
  packages = ["gtfparse"]
47
47
 
48
48
  [tool.ruff]
49
- target-version = "py39"
49
+ target-version = "py311"
50
50
  line-length = 100
51
51
  src = ["gtfparse", "tests"]
52
52
  exclude = [
@@ -78,7 +78,7 @@ ignore = [
78
78
  "B008", # do not perform function calls in argument defaults
79
79
  "B905", # zip() without explicit strict
80
80
  "SIM108", # use ternary operator instead of if-else
81
- "UP007", # use X | Y for type unions (need Python 3.10+)
81
+ "UP007", # retain the established Union annotation style
82
82
  "UP031", # %-format strings
83
83
  ]
84
84
 
gtfparse-3.0.2/PKG-INFO DELETED
@@ -1,157 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: gtfparse
3
- Version: 3.0.2
4
- Summary: Parsing library for extracting data frames of genomic features from GTF files
5
- Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
- License-Expression: Apache-2.0
7
- Project-URL: Homepage, https://github.com/openvax/gtfparse
8
- Project-URL: Bug Tracker, https://github.com/openvax/gtfparse/issues
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Environment :: Console
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
- Requires-Python: >=3.9
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
- Requires-Dist: pyarrow>=18.0.0
24
- Requires-Dist: pandas>=2.2.2
25
- Provides-Extra: polars
26
- Requires-Dist: polars>=0.20.31; extra == "polars"
27
- Provides-Extra: dev
28
- Requires-Dist: pytest; extra == "dev"
29
- Requires-Dist: pytest-cov; extra == "dev"
30
- Requires-Dist: ruff; extra == "dev"
31
- Requires-Dist: coveralls; extra == "dev"
32
- Dynamic: license-file
33
-
34
- [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
35
- [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
36
- <a href="https://pypi.python.org/pypi/gtfparse/">
37
- <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
38
- </a>
39
-
40
- gtfparse
41
- ========
42
- Parsing tools for GTF (gene transfer format) files.
43
-
44
- ## Version 3 migration
45
-
46
- `read_gtf`, `parse_gtf`, and `parse_gtf_and_expand_attributes` now return pandas
47
- DataFrames by default. GTF reading uses PyArrow; attribute processing and writing
48
- use pandas. Polars is no longer a required dependency and is imported only for
49
- explicit Polars conversion. Ordinary installations need only pandas and PyArrow.
50
-
51
- ```sh
52
- pip install gtfparse
53
- # Optional, for applications that still request Polars frames:
54
- pip install 'gtfparse[polars]'
55
- ```
56
-
57
- ```python
58
- from gtfparse import read_gtf, write_gtf
59
-
60
- df = read_gtf("gene_annotations.gtf") # pandas.DataFrame
61
- write_gtf(df, "gene_annotations.gtf.gz")
62
-
63
- # Requires the optional extra:
64
- polars_df = read_gtf("gene_annotations.gtf", result_type="polars")
65
- ```
66
-
67
- Existing pandas and dictionary callers retain their output shape, fixed-column
68
- dtypes, attribute handling, filters, converters and progress callbacks. Applications
69
- that used the previous default Polars output should add `result_type="polars"`
70
- and install the extra, or use pandas methods. `write_gtf` accepts either frame
71
- type. The legacy `parse_with_polars_lazy` helper remains an optional adapter:
72
- it reads the file eagerly and returns a Polars LazyFrame, as before.
73
-
74
- Empty or malformed GTF fields now raise `gtfparse.ParsingError`, including wrong
75
- field counts and invalid numeric fields. Whole comment lines are ignored;
76
- literal `#` inside attributes is preserved. Text and binary streams stay open
77
- after parsing, and gzip is detected from its contents.
78
-
79
- ## Reporting parsing progress
80
-
81
- Pass `progress_callback(stage, completed, total)` to `read_gtf` to connect
82
- parsing to your own progress UI. The callback runs synchronously; exceptions
83
- from it stop parsing and propagate to the caller. Without a callback, gtfparse
84
- does not display a progress bar or add a progress-library dependency.
85
-
86
- | Stage | Reports |
87
- | --- | --- |
88
- | `read` | `(0, None)` before loading/filtering the file; `(rows, rows)` after it succeeds |
89
- | `attributes` | `(0, rows)`, then every 10,000 rows, then `(rows, rows)` |
90
- | `convert` | `(0, None)` before output conversion/transforms; `(rows, rows)` after success |
91
-
92
- Counts refer to rows retained after `features` filtering, not bytes or overall
93
- percentages. `None` means the total is unknown: loading and conversion expose
94
- only stage boundaries, so use an indeterminate indicator during those steps.
95
- Attribute expansion is omitted when `expand_attribute_column=False`. A stage
96
- that fails does not emit completion. An empty filtered result is supported;
97
- its attributes stage emits a single `(0, 0)` event. Empty input files raise `gtfparse.ParsingError`.
98
-
99
- For example, with the optional `tqdm` package installed:
100
-
101
- ```python
102
- from gtfparse import read_gtf
103
- from tqdm.auto import tqdm
104
-
105
- with tqdm(unit="rows") as bar:
106
- def show_progress(stage, completed, total):
107
- if stage != bar.desc:
108
- bar.total = total
109
- bar.reset()
110
- bar.set_description_str(stage)
111
- bar.total = total
112
- bar.update(completed - bar.n)
113
- bar.refresh()
114
-
115
- df = read_gtf("gene_annotations.gtf", progress_callback=show_progress)
116
- ```
117
-
118
- `parse_gtf` reports the `read` stage, `parse_gtf_and_expand_attributes` reports
119
- `read` and `attributes`, `parse_gtf_pandas` reports `read` and `convert`, and
120
- `expand_attribute_strings` reports only `attributes` using the same callback.
121
-
122
- Quoted attribute values preserve spaces, semicolons, and apostrophes. Raw
123
- attributes (`expand_attribute_column=False`) retain their original quote marks.
124
-
125
- # Example usage
126
-
127
- ## Parsing all rows of a GTF file into a Pandas DataFrame
128
-
129
- ```python
130
- from gtfparse import read_gtf
131
-
132
- # returns GTF with essential columns such as "feature", "seqname", "start", "end"
133
- # alongside the names of any optional keys which appeared in the attribute column
134
- df = read_gtf("gene_annotations.gtf")
135
-
136
- # filter DataFrame to gene entries on chrY
137
- df_genes = df[df["feature"] == "gene"]
138
- df_genes_chrY = df_genes[df_genes["seqname"] == "Y"]
139
- ```
140
-
141
-
142
- ## Getting gene FPKM values from a StringTie GTF file
143
-
144
- ```python
145
- from gtfparse import read_gtf
146
-
147
- df = read_gtf(
148
- "Transcripts.gtf",
149
- column_converters={"FPKM": float})
150
-
151
- gene_fpkms = {
152
- gene_name: fpkm
153
- for (gene_name, fpkm, feature)
154
- in zip(df["seqname"], df["FPKM"], df["feature"])
155
- if feature == "gene"
156
- }
157
- ```
gtfparse-3.0.2/README.md DELETED
@@ -1,124 +0,0 @@
1
- [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
2
- [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
3
- <a href="https://pypi.python.org/pypi/gtfparse/">
4
- <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
5
- </a>
6
-
7
- gtfparse
8
- ========
9
- Parsing tools for GTF (gene transfer format) files.
10
-
11
- ## Version 3 migration
12
-
13
- `read_gtf`, `parse_gtf`, and `parse_gtf_and_expand_attributes` now return pandas
14
- DataFrames by default. GTF reading uses PyArrow; attribute processing and writing
15
- use pandas. Polars is no longer a required dependency and is imported only for
16
- explicit Polars conversion. Ordinary installations need only pandas and PyArrow.
17
-
18
- ```sh
19
- pip install gtfparse
20
- # Optional, for applications that still request Polars frames:
21
- pip install 'gtfparse[polars]'
22
- ```
23
-
24
- ```python
25
- from gtfparse import read_gtf, write_gtf
26
-
27
- df = read_gtf("gene_annotations.gtf") # pandas.DataFrame
28
- write_gtf(df, "gene_annotations.gtf.gz")
29
-
30
- # Requires the optional extra:
31
- polars_df = read_gtf("gene_annotations.gtf", result_type="polars")
32
- ```
33
-
34
- Existing pandas and dictionary callers retain their output shape, fixed-column
35
- dtypes, attribute handling, filters, converters and progress callbacks. Applications
36
- that used the previous default Polars output should add `result_type="polars"`
37
- and install the extra, or use pandas methods. `write_gtf` accepts either frame
38
- type. The legacy `parse_with_polars_lazy` helper remains an optional adapter:
39
- it reads the file eagerly and returns a Polars LazyFrame, as before.
40
-
41
- Empty or malformed GTF fields now raise `gtfparse.ParsingError`, including wrong
42
- field counts and invalid numeric fields. Whole comment lines are ignored;
43
- literal `#` inside attributes is preserved. Text and binary streams stay open
44
- after parsing, and gzip is detected from its contents.
45
-
46
- ## Reporting parsing progress
47
-
48
- Pass `progress_callback(stage, completed, total)` to `read_gtf` to connect
49
- parsing to your own progress UI. The callback runs synchronously; exceptions
50
- from it stop parsing and propagate to the caller. Without a callback, gtfparse
51
- does not display a progress bar or add a progress-library dependency.
52
-
53
- | Stage | Reports |
54
- | --- | --- |
55
- | `read` | `(0, None)` before loading/filtering the file; `(rows, rows)` after it succeeds |
56
- | `attributes` | `(0, rows)`, then every 10,000 rows, then `(rows, rows)` |
57
- | `convert` | `(0, None)` before output conversion/transforms; `(rows, rows)` after success |
58
-
59
- Counts refer to rows retained after `features` filtering, not bytes or overall
60
- percentages. `None` means the total is unknown: loading and conversion expose
61
- only stage boundaries, so use an indeterminate indicator during those steps.
62
- Attribute expansion is omitted when `expand_attribute_column=False`. A stage
63
- that fails does not emit completion. An empty filtered result is supported;
64
- its attributes stage emits a single `(0, 0)` event. Empty input files raise `gtfparse.ParsingError`.
65
-
66
- For example, with the optional `tqdm` package installed:
67
-
68
- ```python
69
- from gtfparse import read_gtf
70
- from tqdm.auto import tqdm
71
-
72
- with tqdm(unit="rows") as bar:
73
- def show_progress(stage, completed, total):
74
- if stage != bar.desc:
75
- bar.total = total
76
- bar.reset()
77
- bar.set_description_str(stage)
78
- bar.total = total
79
- bar.update(completed - bar.n)
80
- bar.refresh()
81
-
82
- df = read_gtf("gene_annotations.gtf", progress_callback=show_progress)
83
- ```
84
-
85
- `parse_gtf` reports the `read` stage, `parse_gtf_and_expand_attributes` reports
86
- `read` and `attributes`, `parse_gtf_pandas` reports `read` and `convert`, and
87
- `expand_attribute_strings` reports only `attributes` using the same callback.
88
-
89
- Quoted attribute values preserve spaces, semicolons, and apostrophes. Raw
90
- attributes (`expand_attribute_column=False`) retain their original quote marks.
91
-
92
- # Example usage
93
-
94
- ## Parsing all rows of a GTF file into a Pandas DataFrame
95
-
96
- ```python
97
- from gtfparse import read_gtf
98
-
99
- # returns GTF with essential columns such as "feature", "seqname", "start", "end"
100
- # alongside the names of any optional keys which appeared in the attribute column
101
- df = read_gtf("gene_annotations.gtf")
102
-
103
- # filter DataFrame to gene entries on chrY
104
- df_genes = df[df["feature"] == "gene"]
105
- df_genes_chrY = df_genes[df_genes["seqname"] == "Y"]
106
- ```
107
-
108
-
109
- ## Getting gene FPKM values from a StringTie GTF file
110
-
111
- ```python
112
- from gtfparse import read_gtf
113
-
114
- df = read_gtf(
115
- "Transcripts.gtf",
116
- column_converters={"FPKM": float})
117
-
118
- gene_fpkms = {
119
- gene_name: fpkm
120
- for (gene_name, fpkm, feature)
121
- in zip(df["seqname"], df["FPKM"], df["feature"])
122
- if feature == "gene"
123
- }
124
- ```
@@ -1,157 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: gtfparse
3
- Version: 3.0.2
4
- Summary: Parsing library for extracting data frames of genomic features from GTF files
5
- Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
6
- License-Expression: Apache-2.0
7
- Project-URL: Homepage, https://github.com/openvax/gtfparse
8
- Project-URL: Bug Tracker, https://github.com/openvax/gtfparse/issues
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Environment :: Console
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
- Requires-Python: >=3.9
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
- Requires-Dist: pyarrow>=18.0.0
24
- Requires-Dist: pandas>=2.2.2
25
- Provides-Extra: polars
26
- Requires-Dist: polars>=0.20.31; extra == "polars"
27
- Provides-Extra: dev
28
- Requires-Dist: pytest; extra == "dev"
29
- Requires-Dist: pytest-cov; extra == "dev"
30
- Requires-Dist: ruff; extra == "dev"
31
- Requires-Dist: coveralls; extra == "dev"
32
- Dynamic: license-file
33
-
34
- [![Tests](https://github.com/openvax/gtfparse/actions/workflows/tests.yml/badge.svg)](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
35
- [![Coverage Status](https://coveralls.io/repos/openvax/gtfparse/badge.svg?branch=master&service=github)](https://coveralls.io/github/openvax/gtfparse?branch=master)
36
- <a href="https://pypi.python.org/pypi/gtfparse/">
37
- <img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
38
- </a>
39
-
40
- gtfparse
41
- ========
42
- Parsing tools for GTF (gene transfer format) files.
43
-
44
- ## Version 3 migration
45
-
46
- `read_gtf`, `parse_gtf`, and `parse_gtf_and_expand_attributes` now return pandas
47
- DataFrames by default. GTF reading uses PyArrow; attribute processing and writing
48
- use pandas. Polars is no longer a required dependency and is imported only for
49
- explicit Polars conversion. Ordinary installations need only pandas and PyArrow.
50
-
51
- ```sh
52
- pip install gtfparse
53
- # Optional, for applications that still request Polars frames:
54
- pip install 'gtfparse[polars]'
55
- ```
56
-
57
- ```python
58
- from gtfparse import read_gtf, write_gtf
59
-
60
- df = read_gtf("gene_annotations.gtf") # pandas.DataFrame
61
- write_gtf(df, "gene_annotations.gtf.gz")
62
-
63
- # Requires the optional extra:
64
- polars_df = read_gtf("gene_annotations.gtf", result_type="polars")
65
- ```
66
-
67
- Existing pandas and dictionary callers retain their output shape, fixed-column
68
- dtypes, attribute handling, filters, converters and progress callbacks. Applications
69
- that used the previous default Polars output should add `result_type="polars"`
70
- and install the extra, or use pandas methods. `write_gtf` accepts either frame
71
- type. The legacy `parse_with_polars_lazy` helper remains an optional adapter:
72
- it reads the file eagerly and returns a Polars LazyFrame, as before.
73
-
74
- Empty or malformed GTF fields now raise `gtfparse.ParsingError`, including wrong
75
- field counts and invalid numeric fields. Whole comment lines are ignored;
76
- literal `#` inside attributes is preserved. Text and binary streams stay open
77
- after parsing, and gzip is detected from its contents.
78
-
79
- ## Reporting parsing progress
80
-
81
- Pass `progress_callback(stage, completed, total)` to `read_gtf` to connect
82
- parsing to your own progress UI. The callback runs synchronously; exceptions
83
- from it stop parsing and propagate to the caller. Without a callback, gtfparse
84
- does not display a progress bar or add a progress-library dependency.
85
-
86
- | Stage | Reports |
87
- | --- | --- |
88
- | `read` | `(0, None)` before loading/filtering the file; `(rows, rows)` after it succeeds |
89
- | `attributes` | `(0, rows)`, then every 10,000 rows, then `(rows, rows)` |
90
- | `convert` | `(0, None)` before output conversion/transforms; `(rows, rows)` after success |
91
-
92
- Counts refer to rows retained after `features` filtering, not bytes or overall
93
- percentages. `None` means the total is unknown: loading and conversion expose
94
- only stage boundaries, so use an indeterminate indicator during those steps.
95
- Attribute expansion is omitted when `expand_attribute_column=False`. A stage
96
- that fails does not emit completion. An empty filtered result is supported;
97
- its attributes stage emits a single `(0, 0)` event. Empty input files raise `gtfparse.ParsingError`.
98
-
99
- For example, with the optional `tqdm` package installed:
100
-
101
- ```python
102
- from gtfparse import read_gtf
103
- from tqdm.auto import tqdm
104
-
105
- with tqdm(unit="rows") as bar:
106
- def show_progress(stage, completed, total):
107
- if stage != bar.desc:
108
- bar.total = total
109
- bar.reset()
110
- bar.set_description_str(stage)
111
- bar.total = total
112
- bar.update(completed - bar.n)
113
- bar.refresh()
114
-
115
- df = read_gtf("gene_annotations.gtf", progress_callback=show_progress)
116
- ```
117
-
118
- `parse_gtf` reports the `read` stage, `parse_gtf_and_expand_attributes` reports
119
- `read` and `attributes`, `parse_gtf_pandas` reports `read` and `convert`, and
120
- `expand_attribute_strings` reports only `attributes` using the same callback.
121
-
122
- Quoted attribute values preserve spaces, semicolons, and apostrophes. Raw
123
- attributes (`expand_attribute_column=False`) retain their original quote marks.
124
-
125
- # Example usage
126
-
127
- ## Parsing all rows of a GTF file into a Pandas DataFrame
128
-
129
- ```python
130
- from gtfparse import read_gtf
131
-
132
- # returns GTF with essential columns such as "feature", "seqname", "start", "end"
133
- # alongside the names of any optional keys which appeared in the attribute column
134
- df = read_gtf("gene_annotations.gtf")
135
-
136
- # filter DataFrame to gene entries on chrY
137
- df_genes = df[df["feature"] == "gene"]
138
- df_genes_chrY = df_genes[df_genes["seqname"] == "Y"]
139
- ```
140
-
141
-
142
- ## Getting gene FPKM values from a StringTie GTF file
143
-
144
- ```python
145
- from gtfparse import read_gtf
146
-
147
- df = read_gtf(
148
- "Transcripts.gtf",
149
- column_converters={"FPKM": float})
150
-
151
- gene_fpkms = {
152
- gene_name: fpkm
153
- for (gene_name, fpkm, feature)
154
- in zip(df["seqname"], df["FPKM"], df["feature"])
155
- if feature == "gene"
156
- }
157
- ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes