Skip to content

Commit

Permalink
Check validity of spreadsheet
Browse files Browse the repository at this point in the history
Avoids cryptic KeyError: ' '
  • Loading branch information
veghp committed Feb 26, 2025
1 parent 01b0ecd commit 40109c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion genedom/PartDomesticator/GoldenGateDomesticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def details_list(self):
def standard_from_spreadsheet(path=None, dataframe=None, name_prefix=""):
"""Parse a spreadsheet into a standard with Golden Gate domesticators.
The input should be a table with columns names as follows:
The input should be a table with the following column names:
slot_name, left_overhang, right_overhang, left_addition,
right_addition, enzyme, extra_avoided_sites, description.
Expand All @@ -165,6 +165,12 @@ def standard_from_spreadsheet(path=None, dataframe=None, name_prefix=""):
dataframe = pandas.read_csv(path)
else:
dataframe = pandas.read_excel(path)
if dataframe['slot_name'].str.contains(r'\s+').any():
raise ValueError("Whitespace in slot_name column!")
if dataframe['left_overhang'].str.contains(r'\s+').any():
raise ValueError("Whitespace in left_overhang column!")
if dataframe['right_overhang'].str.contains(r'\s+').any():
raise ValueError("Whitespace in right_overhang column!")
return StandardDomesticatorsSet(
OrderedDict(
[
Expand Down

0 comments on commit 40109c1

Please sign in to comment.