From 8f9bf8fa04b5e0c41af9a3418127ea651626cb57 Mon Sep 17 00:00:00 2001 From: Alex Rubinsteyn Date: Mon, 19 Feb 2018 17:50:29 -0500 Subject: [PATCH 1/2] create list of multiple values --- gtfparse/attribute_parsing.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gtfparse/attribute_parsing.py b/gtfparse/attribute_parsing.py index b07115c..1cd0c6b 100644 --- a/gtfparse/attribute_parsing.py +++ b/gtfparse/attribute_parsing.py @@ -101,7 +101,15 @@ def expand_attribute_strings( value = intern(str(value)) value_interned_strings[value] = value - column[i] = value + # if an attribute is used repeatedly then + # keep track of all its values in a list + current_row = column[i] + if current_row == missing_value: + column[i] = value + elif type(current_row) is list: + current_row.append(value) + else: + column[i] = [value] logging.debug( "Memory usage after expanding GTF attributes: %0.4f MB" % ( From af690859306f0a036828357bb3319a3e81b3bc60 Mon Sep 17 00:00:00 2001 From: Alex Rubinsteyn Date: Mon, 19 Feb 2018 17:51:34 -0500 Subject: [PATCH 2/2] version bump --- gtfparse/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtfparse/__init__.py b/gtfparse/__init__.py index fc393c4..4d3af86 100644 --- a/gtfparse/__init__.py +++ b/gtfparse/__init__.py @@ -19,7 +19,7 @@ from .parsing_error import ParsingError from .read_gtf import read_gtf_as_dataframe, read_gtf_as_dict -__version__ = "0.1.0" +__version__ = "0.2.0" __all__ = [ "expand_attribute_strings",