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", 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" % (