Skip to content

Commit

Permalink
Added cell deletion support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Jan 23, 2024
1 parent edf3341 commit 4f6407d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions dcicutils/data_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

class RowReader(abc.ABC):

DELETION_CELL_VALUE = "*delete*"

def __init__(self):
self.header = None
self.row_number = 0
Expand Down Expand Up @@ -45,8 +47,13 @@ def is_comment_row(self, row: Union[List[Optional[Any]], Tuple[Optional[Any]]])
def is_terminating_row(self, row: Union[List[Optional[Any]], Tuple[Optional[Any]]]) -> bool:
return False

def cell_value(self, value: Optional[Any]) -> Optional[Any]:
return str(value).strip() if value is not None else ""
def cell_value(self, value: Optional[Any]) -> str:
if value is None:
return ""
elif (value := str(value).strip()) == RowReader.DELETION_CELL_VALUE:
return RowReader.DELETION_CELL_VALUE
else:
return value

def open(self) -> None:
pass
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.7.1.1b2" # TODO: To become 8.7.2
version = "8.7.1.1b3" # TODO: To become 8.7.2
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down

0 comments on commit 4f6407d

Please sign in to comment.