Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class MSDWorkbenchParser(VendorParser[Data, Model]):
def create_data(self, named_file_contents: NamedFileContents) -> Data:
if named_file_contents.extension == "txt":
return self._process_methodical_mind(named_file_contents)
# CSV and XLSX files use MSD Workbench format
return self._process_msd_workbench(named_file_contents)

def _process_methodical_mind(self, named_file_contents: NamedFileContents) -> Data:
Expand Down
12 changes: 10 additions & 2 deletions src/allotropy/parsers/msd_workbench/msd_workbench_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@


class MSDWorkbenchReader:
SUPPORTED_EXTENSIONS = "csv, txt"
SUPPORTED_EXTENSIONS = "csv, txt, xlsx"
plate_data: pd.DataFrame
well_plate_id: str

def __init__(self, named_file_contents: NamedFileContents) -> None:
data = read_csv(named_file_contents.contents)
if named_file_contents.extension == "xlsx":
# Read the Workbench data sheet from Excel file
data = pd.read_excel(
named_file_contents.contents,
sheet_name="Workbench data",
engine="openpyxl",
)
else:
data = read_csv(named_file_contents.contents)
data = data.where(pd.notna(data), None)
data.index = pd.Index(data.index.to_series().ffill())
data.index = data.index.astype(str).str.strip()
Expand Down
Loading
Loading