gtfparse 2.2.0__tar.gz → 2.3.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.
Files changed (23) hide show
  1. {gtfparse-2.2.0 → gtfparse-2.3.0}/PKG-INFO +1 -1
  2. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse/__init__.py +1 -1
  3. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse/create_missing_features.py +12 -6
  4. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse.egg-info/PKG-INFO +1 -1
  5. {gtfparse-2.2.0 → gtfparse-2.3.0}/LICENSE +0 -0
  6. {gtfparse-2.2.0 → gtfparse-2.3.0}/README.md +0 -0
  7. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse/attribute_parsing.py +0 -0
  8. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse/parsing_error.py +0 -0
  9. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse/read_gtf.py +0 -0
  10. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse.egg-info/SOURCES.txt +0 -0
  11. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse.egg-info/dependency_links.txt +0 -0
  12. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse.egg-info/requires.txt +0 -0
  13. {gtfparse-2.2.0 → gtfparse-2.3.0}/gtfparse.egg-info/top_level.txt +0 -0
  14. {gtfparse-2.2.0 → gtfparse-2.3.0}/pyproject.toml +0 -0
  15. {gtfparse-2.2.0 → gtfparse-2.3.0}/requirements.txt +0 -0
  16. {gtfparse-2.2.0 → gtfparse-2.3.0}/setup.cfg +0 -0
  17. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_create_missing_features.py +0 -0
  18. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_ensembl_gtf.py +0 -0
  19. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_expand_attributes.py +0 -0
  20. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_multiple_values_for_tag_attribute.py +0 -0
  21. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_parse_gtf_lines.py +0 -0
  22. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_read_stringtie_gtf.py +0 -0
  23. {gtfparse-2.2.0 → gtfparse-2.3.0}/tests/test_refseq_gtf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtfparse
3
- Version: 2.2.0
3
+ Version: 2.3.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
@@ -21,7 +21,7 @@ from .read_gtf import (
21
21
  REQUIRED_COLUMNS,
22
22
  )
23
23
 
24
- __version__ = "2.2.0"
24
+ __version__ = "2.3.0"
25
25
 
26
26
  __all__ = [
27
27
  "__version__",
@@ -49,15 +49,19 @@ def create_missing_features(
49
49
  missing_value : any
50
50
  Which value to fill in for columns that we don't infer values for.
51
51
 
52
- Returns original dataframe along with all extra rows created for missing
53
- features.
52
+ Returns original dataframe (converted to Pandas if necessary) along with all
53
+ extra rows created for missing features.
54
54
  """
55
+ if hasattr(dataframe, "to_pandas"):
56
+ dataframe = dataframe.to_pandas()
57
+
55
58
  extra_dataframes = []
56
59
 
57
60
  existing_features = set(dataframe["feature"])
58
61
  existing_columns = set(dataframe.columns)
59
-
62
+
60
63
  for (feature_name, groupby_key) in unique_keys.items():
64
+
61
65
  if feature_name in existing_features:
62
66
  logging.info(
63
67
  "Feature '%s' already exists in GTF data" % feature_name)
@@ -65,9 +69,11 @@ def create_missing_features(
65
69
  logging.info("Creating rows for missing feature '%s'" % feature_name)
66
70
 
67
71
  # don't include rows where the groupby key was missing
68
- empty_key_values = dataframe[groupby_key].map(
69
- lambda x: x == "" or x is None)
70
- row_groups = dataframe[~empty_key_values].groupby(groupby_key)
72
+ missing = pd.Series([
73
+ x is None or x == ""
74
+ for x in dataframe[groupby_key]])
75
+ not_missing = ~missing
76
+ row_groups = dataframe[not_missing].groupby(groupby_key)
71
77
 
72
78
  # Each group corresponds to a unique feature entry for which the
73
79
  # other columns may or may not be uniquely defined. Start off by
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtfparse
3
- Version: 2.2.0
3
+ Version: 2.3.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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes