gtfparse 2.4.1__tar.gz → 2.6.0__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.
- {gtfparse-2.4.1 → gtfparse-2.6.0}/PKG-INFO +7 -7
- {gtfparse-2.4.1 → gtfparse-2.6.0}/README.md +1 -3
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse/__init__.py +1 -1
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse/read_gtf.py +22 -21
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse.egg-info/PKG-INFO +7 -7
- gtfparse-2.6.0/gtfparse.egg-info/requires.txt +3 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/pyproject.toml +1 -1
- gtfparse-2.6.0/requirements.txt +3 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_ensembl_gtf.py +1 -1
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_read_stringtie_gtf.py +1 -1
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_refseq_gtf.py +1 -1
- gtfparse-2.4.1/gtfparse.egg-info/requires.txt +0 -2
- gtfparse-2.4.1/requirements.txt +0 -2
- {gtfparse-2.4.1 → gtfparse-2.6.0}/LICENSE +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse/attribute_parsing.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse/create_missing_features.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse/parsing_error.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse.egg-info/SOURCES.txt +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse.egg-info/dependency_links.txt +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/gtfparse.egg-info/top_level.txt +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/setup.cfg +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_create_missing_features.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_expand_attributes.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_multiple_values_for_tag_attribute.py +0 -0
- {gtfparse-2.4.1 → gtfparse-2.6.0}/tests/test_parse_gtf_lines.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: gtfparse
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.0
|
|
4
4
|
Summary: Parsing library for extracting data frames of genomic features from GTF files
|
|
5
5
|
Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/openvax/gtfparse
|
|
@@ -15,12 +15,12 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
15
15
|
Requires-Python: >=3.7
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: polars
|
|
19
|
-
Requires-Dist: pyarrow
|
|
18
|
+
Requires-Dist: polars>=0.20.2
|
|
19
|
+
Requires-Dist: pyarrow>=18.0.0
|
|
20
|
+
Requires-Dist: pandas>=2.1.0
|
|
21
|
+
Dynamic: license-file
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
[](https://travis-ci.org/openvax/gtfparse)
|
|
23
|
-
-->
|
|
23
|
+
[](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
|
|
24
24
|
[](https://coveralls.io/github/openvax/gtfparse?branch=master)
|
|
25
25
|
<a href="https://pypi.python.org/pypi/gtfparse/">
|
|
26
26
|
<img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
[](https://travis-ci.org/openvax/gtfparse)
|
|
3
|
-
-->
|
|
1
|
+
[](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
|
|
4
2
|
[](https://coveralls.io/github/openvax/gtfparse?branch=master)
|
|
5
3
|
<a href="https://pypi.python.org/pypi/gtfparse/">
|
|
6
4
|
<img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
import logging
|
|
14
14
|
from os.path import exists
|
|
15
|
-
from io import StringIO
|
|
16
|
-
import gzip
|
|
17
15
|
|
|
18
16
|
import polars
|
|
19
17
|
|
|
@@ -103,15 +101,18 @@ def parse_with_polars_lazy(
|
|
|
103
101
|
separator="\t",
|
|
104
102
|
comment_prefix="#",
|
|
105
103
|
null_values=".",
|
|
106
|
-
|
|
104
|
+
schema_overrides=DEFAULT_COLUMN_DTYPES)
|
|
107
105
|
try:
|
|
108
106
|
df = polars.read_csv(
|
|
109
107
|
filepath_or_buffer,
|
|
110
108
|
new_columns=REQUIRED_COLUMNS,
|
|
111
109
|
**kwargs).lazy()
|
|
112
|
-
except polars.ShapeError:
|
|
110
|
+
except polars.exceptions.ShapeError:
|
|
113
111
|
raise ParsingError("Wrong number of columns")
|
|
114
112
|
|
|
113
|
+
# Drop empty lines that may appear as all-null rows
|
|
114
|
+
df = df.filter(polars.col("seqname").is_not_null())
|
|
115
|
+
|
|
115
116
|
df = df.with_columns([
|
|
116
117
|
polars.col("frame").fill_null(0),
|
|
117
118
|
polars.col("attribute").str.replace_all('"', "'")
|
|
@@ -253,11 +254,11 @@ def read_gtf(
|
|
|
253
254
|
else:
|
|
254
255
|
result_df = parse_gtf(result_df, features=features)
|
|
255
256
|
|
|
256
|
-
|
|
257
|
+
# converting back to pandas here because Polars bugs manifest
|
|
258
|
+
# as `pyo3_runtime.PanicException: assertion `left == right` failed: impl error`
|
|
259
|
+
# and are generally insane to chase down
|
|
260
|
+
result_df = result_df.to_pandas()
|
|
257
261
|
if column_converters or column_cast_types:
|
|
258
|
-
# transform columns with user-specified functions and/or cast them to user-specified types
|
|
259
|
-
polars_expressions = []
|
|
260
|
-
|
|
261
262
|
def wrap_to_always_accept_none(f):
|
|
262
263
|
def wrapped_fn(x):
|
|
263
264
|
if x is None or x == "":
|
|
@@ -268,17 +269,16 @@ def read_gtf(
|
|
|
268
269
|
|
|
269
270
|
column_names = set(column_converters.keys()).union(column_cast_types.keys())
|
|
270
271
|
for column_name in column_names:
|
|
271
|
-
|
|
272
|
+
|
|
272
273
|
if column_name in column_converters:
|
|
273
|
-
column_fn =
|
|
274
|
-
|
|
274
|
+
column_fn = wrap_to_always_accept_none(
|
|
275
|
+
column_converters[column_name])
|
|
276
|
+
result_df[column_name] = result_df[column_name].apply(column_fn)
|
|
275
277
|
|
|
276
278
|
if column_name in column_cast_types:
|
|
277
279
|
column_type = column_cast_types[column_name]
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
result_df = result_df.with_columns(polars_expressions)
|
|
281
|
-
|
|
280
|
+
result_df[column_name] = result_df[column_name].astype(column_type)
|
|
281
|
+
|
|
282
282
|
# Hackishly infer whether the values in the 'source' column of this GTF
|
|
283
283
|
# are actually representing a biotype by checking for the most common
|
|
284
284
|
# gene_biotype and transcript_biotype value 'protein_coding'
|
|
@@ -292,20 +292,21 @@ def read_gtf(
|
|
|
292
292
|
# gene_biotype)
|
|
293
293
|
if "gene_biotype" not in column_names:
|
|
294
294
|
logging.info("Using column 'source' to replace missing 'gene_biotype'")
|
|
295
|
-
result_df = result_df
|
|
295
|
+
result_df['gene_biotype'] = result_df['source']
|
|
296
296
|
if "transcript_biotype" not in column_names:
|
|
297
297
|
logging.info("Using column 'source' to replace missing 'transcript_biotype'")
|
|
298
|
-
result_df = result_df
|
|
299
|
-
|
|
298
|
+
result_df['transcript_biotype'] = result_df['source']
|
|
299
|
+
|
|
300
300
|
if usecols is not None:
|
|
301
301
|
column_names = set(result_df.columns)
|
|
302
302
|
valid_columns = [c for c in usecols if c in column_names]
|
|
303
|
-
result_df = result_df
|
|
303
|
+
result_df = result_df[valid_columns]
|
|
304
304
|
|
|
305
|
+
result = None
|
|
305
306
|
if result_type == "pandas":
|
|
306
|
-
result = result_df.to_pandas()
|
|
307
|
-
elif result_type == "polars":
|
|
308
307
|
result = result_df
|
|
308
|
+
elif result_type == "polars":
|
|
309
|
+
result = polars.from_pandas(result_df)
|
|
309
310
|
elif result_type == "dict":
|
|
310
311
|
result = result_df.to_dict()
|
|
311
312
|
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: gtfparse
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.6.0
|
|
4
4
|
Summary: Parsing library for extracting data frames of genomic features from GTF files
|
|
5
5
|
Author-email: Alex Rubinsteyn <alex.rubinsteyn@unc.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/openvax/gtfparse
|
|
@@ -15,12 +15,12 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
15
15
|
Requires-Python: >=3.7
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: polars
|
|
19
|
-
Requires-Dist: pyarrow
|
|
18
|
+
Requires-Dist: polars>=0.20.2
|
|
19
|
+
Requires-Dist: pyarrow>=18.0.0
|
|
20
|
+
Requires-Dist: pandas>=2.1.0
|
|
21
|
+
Dynamic: license-file
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
[](https://travis-ci.org/openvax/gtfparse)
|
|
23
|
-
-->
|
|
23
|
+
[](https://github.com/openvax/gtfparse/actions/workflows/tests.yml)
|
|
24
24
|
[](https://coveralls.io/github/openvax/gtfparse?branch=master)
|
|
25
25
|
<a href="https://pypi.python.org/pypi/gtfparse/">
|
|
26
26
|
<img src="https://img.shields.io/pypi/v/gtfparse.svg?maxAge=1000" alt="PyPI" />
|
gtfparse-2.4.1/requirements.txt
DELETED
|
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
|