Skip to content

Commit

Permalink
Updated EnzymeML Template Example
Browse files Browse the repository at this point in the history
  • Loading branch information
JR-1991 committed Mar 9, 2022
1 parent 7f70906 commit 0032552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pyenzyme/enzymeml/tools/templatereader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pandas as pd
import numpy as np
import re

from typing import List, Dict
Expand Down Expand Up @@ -28,7 +27,7 @@ def read_template(path: str, enzmldoc):

params = dict(
name=general_info.iloc[0, 1],
created=str(general_info.iloc[1, 1]),
created=str(general_info.iloc[1, 1].date()),
doi=None,
pubmedid=general_info.iloc[3, 1],
url=general_info.iloc[4, 1],
Expand Down Expand Up @@ -66,6 +65,7 @@ def read_template(path: str, enzmldoc):

# Reactants
reactants = pd.read_excel(path, sheet_name="Reactants", skiprows=2)

instances = get_instances(reactants, Reactant, enzmldoc)

for instance in instances:
Expand Down Expand Up @@ -202,7 +202,6 @@ def get_template_map(obj) -> dict:


def extract_values(sheet: pd.DataFrame, mapping: Dict[str, str]) -> list:
sheet = sheet.replace(r"^\s*$", np.nan, regex=True)
sheet = sheet.dropna(thresh=len(mapping))
records = sheet.to_dict(orient="records")

Expand Down Expand Up @@ -309,7 +308,7 @@ def parse_reaction_element(elements):
if repr(elements) == "nan":
return []

return elements.split(";")
return elements.split(",")


def add_instances(fun, elements, enzmldoc) -> None:
Expand Down
Binary file modified tests/fixtures/EnzymeML_Template_Example.xlsm
Binary file not shown.

0 comments on commit 0032552

Please sign in to comment.