From 946f11119b9d1c7677f29ab6a0df5d5f36c3eef8 Mon Sep 17 00:00:00 2001 From: tramyn Date: Fri, 9 Oct 2020 17:55:54 -0700 Subject: [PATCH 1/3] create convert_part_library function in main.py --- excel2sbol/main.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/excel2sbol/main.py b/excel2sbol/main.py index 2c43737c..b01849c8 100644 --- a/excel2sbol/main.py +++ b/excel2sbol/main.py @@ -1,4 +1,28 @@ import argparse +import excel2sbol.utils.converter_utils as converter_utils +import pandas as pd + +def convert_part_library(input_excel: str, output_file: str): + # Read in template and filled spreadsheet for the Parts library + start_row = 13 + nrows = 8 + description_row = 9 + + filled_library, filled_library_metadata, filled_description = converter_utils.read_library(input_excel, + start_row=start_row, nrows=nrows, + description_row=description_row) + blank_library, blank_library_metadata, blank_description = converter_utils.read_library(input_excel, + start_row=start_row, nrows=nrows, + description_row=description_row) + + ontology = pd.read_excel(input_excel, header=None, sheet_name="Ontology Terms", skiprows=3, index_col=0) + ontology = ontology.to_dict("dict")[1] + + converter_utils.quality_check(filled_library, blank_library, filled_library_metadata, blank_library_metadata, filled_description, blank_description) + + # Create SBOL document + doc = converter_utils.write_sbol(filled_library, filled_library_metadata, filled_description, ontology) + doc.write(output_file) def main(): parser = argparse.ArgumentParser(description='Creates libraries of basic parts by converting a spreadsheet to SBOL.') From 4a8c79ed2c69a9acee7700d8c33abe50518940f4 Mon Sep 17 00:00:00 2001 From: tramyn Date: Fri, 9 Oct 2020 18:32:21 -0700 Subject: [PATCH 2/3] create structure for reading excel templates --- excel2sbol/converter/part_library_converter.py | 2 +- excel2sbol/converter/template.py | 5 +++++ excel2sbol/converter/template_factory.py | 7 +++++++ excel2sbol/main.py | 4 ++-- .../resources/Composition_reading.py | 4 ++-- Excel.py => excel2sbol/resources/Excel.py | 6 +++--- .../resources/templates}/darpa_template_blank.xlsx | Bin excel2sbol/utils/excel_template_constants.py | 0 8 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 excel2sbol/converter/template.py create mode 100644 excel2sbol/converter/template_factory.py rename Composition_reading.py => excel2sbol/resources/Composition_reading.py (89%) rename Excel.py => excel2sbol/resources/Excel.py (80%) rename {templates => excel2sbol/resources/templates}/darpa_template_blank.xlsx (100%) create mode 100644 excel2sbol/utils/excel_template_constants.py diff --git a/excel2sbol/converter/part_library_converter.py b/excel2sbol/converter/part_library_converter.py index 17471777..ee3f71c0 100644 --- a/excel2sbol/converter/part_library_converter.py +++ b/excel2sbol/converter/part_library_converter.py @@ -1,5 +1,5 @@ class PartLibraryConverter(object): - + DARPA_TEMPLATE = '' def __init__(self): pass \ No newline at end of file diff --git a/excel2sbol/converter/template.py b/excel2sbol/converter/template.py new file mode 100644 index 00000000..f868acdc --- /dev/null +++ b/excel2sbol/converter/template.py @@ -0,0 +1,5 @@ + +class Template(object): + + def __init__(self): + pass diff --git a/excel2sbol/converter/template_factory.py b/excel2sbol/converter/template_factory.py new file mode 100644 index 00000000..9106f160 --- /dev/null +++ b/excel2sbol/converter/template_factory.py @@ -0,0 +1,7 @@ +class TemplateFactory(object): + + def __init__(self): + pass + + def create_darpa_template(self): + pass diff --git a/excel2sbol/main.py b/excel2sbol/main.py index b01849c8..1ac7b998 100644 --- a/excel2sbol/main.py +++ b/excel2sbol/main.py @@ -7,11 +7,11 @@ def convert_part_library(input_excel: str, output_file: str): start_row = 13 nrows = 8 description_row = 9 - + path_blank = None # TODO: os.path.join(cwd, "templates/darpa_template_blank.xlsx") filled_library, filled_library_metadata, filled_description = converter_utils.read_library(input_excel, start_row=start_row, nrows=nrows, description_row=description_row) - blank_library, blank_library_metadata, blank_description = converter_utils.read_library(input_excel, + blank_library, blank_library_metadata, blank_description = converter_utils.read_library(path_blank, start_row=start_row, nrows=nrows, description_row=description_row) diff --git a/Composition_reading.py b/excel2sbol/resources/Composition_reading.py similarity index 89% rename from Composition_reading.py rename to excel2sbol/resources/Composition_reading.py index a384a71f..f8b35572 100644 --- a/Composition_reading.py +++ b/excel2sbol/resources/Composition_reading.py @@ -8,8 +8,8 @@ #Set up import os import pandas as pd -from excel2sbol.functions import quality_check_metadata, load_libraries, get_data -from excel2sbol.functions import get_parts, check_name, write_sbol_comp, fix_msec_sbol +from excel2sbol.utils.converter_utils import quality_check_metadata, load_libraries, get_data +from excel2sbol.utils.converter_utils import get_parts, check_name, write_sbol_comp, fix_msec_sbol cwd = os.path.dirname(os.path.abspath("__file__")) #get current working directory path_filled = os.path.join(cwd, "templates", "darpa_template.xlsx") diff --git a/Excel.py b/excel2sbol/resources/Excel.py similarity index 80% rename from Excel.py rename to excel2sbol/resources/Excel.py index 4d6d29a2..c110ecf1 100644 --- a/Excel.py +++ b/excel2sbol/resources/Excel.py @@ -9,13 +9,13 @@ #Setup import pandas as pd import os -from excel2sbol.functions import read_library, quality_check, write_sbol +from excel2sbol.utils.converter_utils import read_library, quality_check, write_sbol cwd = os.path.dirname(os.path.abspath("__file__")) #get current working directory path_blank = os.path.join(cwd, "templates/darpa_template_blank.xlsx") -# path_filled = os.path.join("C:\\Users\\JVM\\Downloads\\build-request-template_BsPpVn.xlsx") -# file_path_out = "C:\\Users\\JVM\\Downloads\\converted.xml" +path_filled = None #os.path.join("C:\\Users\\JVM\\Downloads\\build-request-template_BsPpVn.xlsx") +file_path_out = None #"C:\\Users\\JVM\\Downloads\\converted.xml" #Read in template and filled spreadsheet for the Parts library start_row = 13 diff --git a/templates/darpa_template_blank.xlsx b/excel2sbol/resources/templates/darpa_template_blank.xlsx similarity index 100% rename from templates/darpa_template_blank.xlsx rename to excel2sbol/resources/templates/darpa_template_blank.xlsx diff --git a/excel2sbol/utils/excel_template_constants.py b/excel2sbol/utils/excel_template_constants.py new file mode 100644 index 00000000..e69de29b From d46e156c064a911894b2c90bec477c50705de79d Mon Sep 17 00:00:00 2001 From: tramyn Date: Fri, 9 Oct 2020 19:59:22 -0700 Subject: [PATCH 3/3] create golden file testing for convering part library and composite reading --- excel2sbol/main.py | 49 ++++++++++++++++-- .../tests/data/darpa_template_blank.xlsx | Bin 0 -> 20983 bytes excel2sbol/tests/test_golden_files.py | 29 +++++++++-- excel2sbol/utils/converter_utils.py | 14 ++--- requirements.txt | 1 + 5 files changed, 78 insertions(+), 15 deletions(-) create mode 100644 excel2sbol/tests/data/darpa_template_blank.xlsx diff --git a/excel2sbol/main.py b/excel2sbol/main.py index 1ac7b998..50c470e0 100644 --- a/excel2sbol/main.py +++ b/excel2sbol/main.py @@ -2,27 +2,66 @@ import excel2sbol.utils.converter_utils as converter_utils import pandas as pd -def convert_part_library(input_excel: str, output_file: str): +def convert_part_library(template_file: str, input_excel: str): # Read in template and filled spreadsheet for the Parts library start_row = 13 nrows = 8 description_row = 9 - path_blank = None # TODO: os.path.join(cwd, "templates/darpa_template_blank.xlsx") filled_library, filled_library_metadata, filled_description = converter_utils.read_library(input_excel, start_row=start_row, nrows=nrows, description_row=description_row) - blank_library, blank_library_metadata, blank_description = converter_utils.read_library(path_blank, + blank_library, blank_library_metadata, blank_description = converter_utils.read_library(template_file, start_row=start_row, nrows=nrows, description_row=description_row) ontology = pd.read_excel(input_excel, header=None, sheet_name="Ontology Terms", skiprows=3, index_col=0) ontology = ontology.to_dict("dict")[1] - converter_utils.quality_check(filled_library, blank_library, filled_library_metadata, blank_library_metadata, filled_description, blank_description) + converter_utils.quality_check(filled_library, + blank_library, + filled_library_metadata, + blank_library_metadata, + filled_description, + blank_description, nrows, description_row) # Create SBOL document doc = converter_utils.write_sbol(filled_library, filled_library_metadata, filled_description, ontology) - doc.write(output_file) + return doc + +def convert_composition_reading(template_file: str, input_excel: str): + # Load Data + startrow_composition = 9 + sheet_name = "Composite Parts" + nrows = 8 + use_cols = [0, 1] + # read in whole composite sheet below metadata + table = pd.read_excel(input_excel, sheet_name=sheet_name, + header=None, skiprows=startrow_composition) + + # Load Metadata + filled_composition_metadata = pd.read_excel(input_excel, sheet_name=sheet_name, + header=None, nrows=nrows, usecols=use_cols) + blank_composition_metadata = pd.read_excel(template_file, sheet_name=sheet_name, + header=None, nrows=nrows, usecols=use_cols) + + # Compare the metadata to the template + converter_utils.quality_check_metadata(filled_composition_metadata, blank_composition_metadata) + + # Load Libraries required for Parts + libraries = converter_utils.load_libraries(table) + + # Loop over all rows and find those where each block begins + compositions, list_of_rows = converter_utils.get_data(table) + + # Extract parts from table + compositions, all_parts = converter_utils.get_parts(list_of_rows, table, compositions) + + # Check if Collection names are alphanumeric and separated by underscore + compositions = converter_utils.check_name(compositions) + + # Create sbol + doc = converter_utils.write_sbol_comp(libraries, compositions, all_parts) + return doc def main(): parser = argparse.ArgumentParser(description='Creates libraries of basic parts by converting a spreadsheet to SBOL.') diff --git a/excel2sbol/tests/data/darpa_template_blank.xlsx b/excel2sbol/tests/data/darpa_template_blank.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..20cce1f6660c1b84f628ccf8b9ea9e6c5ac534cb GIT binary patch literal 20983 zcmeIa1z23mvM`E-012+aHMoTkG`K^65ZooWyTb%05Zv9}-QC^Yg1cL=nKw!HIeVY% z-1q(elY8I$&KZVY)wQZ>Rdsjun(pfE_ma?0Fd&{nz(GJjkU-2%*08xiLO^W7KtP~F zz(J`AT3XoYTi9vIJ6q}7YA`sNn-OO`fuc%-fCAJ1=ksq|0z*+6G9649ekW27$dZ_ z#CR0=M9LzXwenq)R0?M;Df|-=eq%&~j2>c<&cUGeEQc3pC9EXqFyW1n%$qQZC?5{S zPKT!Mo&{(5Z-r$Wi6nPktwG^*UPI13H({vvoXL_7=n@ow7SG=SftAp(h=z z%nAD;A4x8=tg&(L8CFNaCwDh%K1Mn|n`Uh0aH1i9&o>sKezNeXG;u8QRi=L`xV3>m z&=Bwc#bv7%n8+@{ciw?L@;TULwQTgwY#AB8r~h%)e`Ejri|IuXQZk)P2!1DG5B_~O z)5~Ef0+NpWVvQv79-qXQkgJ0;$?=w3De+O{alN5M0nHu{1B=UVgZKMLuGd+Lg3vIy z$Z8ym{bKK|?O|ysY+^*Li`KeO9j33Quj54}oT(g|Lum@@^3o;ySII;s&xF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m z-e5xMIiWp6iaD9`EEy}X`SM<;8&W9y>2b+x<0AXRzSly-JfkiBEpwcosi>_M79VcU zw{~#UG>LF~IRlKmM{m1HHxQcOv#;)xc(Hj$0akul?)e(0VcJ-7bMm}OV-%}Kq&lCr1?1`FGhIddaoN*L%cAOp22#5rg$UG@mvz=G=E`NOiP<_ zXO67%3HRFDIgP3ERA@rk*>q!QRVZ*sG2dB2%}Qsr5=z%Qb%bMt5fz~ARtCi8sTHo9 zeqtHKPCsB?OcrJA*egu%{G8{AxS?H7!?e}^TWO6L~z`6mJC(C)glkD0V_6!r0c;9b`Qj0Iz%0*EF%Qx+@D1-PKO&za3s_unqs#*#rtK$|a zQhoMX5?APw=K>~$(S$Rd^$Al+242L=kD+63q6Ueq{ z)^mPZPD+xE0XZNmxP3(2d_Z;{b6$d zaD#tbe{;0luLAz{XsdrPe!o_N`6~7Ajbw~W40$fpk2>5e<{I9IP?#cXVOkKLFZy%tHVG literal 0 HcmV?d00001 diff --git a/excel2sbol/tests/test_golden_files.py b/excel2sbol/tests/test_golden_files.py index c8c8e950..f1e617cf 100644 --- a/excel2sbol/tests/test_golden_files.py +++ b/excel2sbol/tests/test_golden_files.py @@ -1,14 +1,37 @@ +import excel2sbol.main as tool import os import unittest class GoldenFileTest(unittest.TestCase): - def setup(self): + @classmethod + def setUpClass(cls): + pass + + def setUp(self): curr_path = os.path.dirname(os.path.realpath(__file__)) self.data_dir = os.path.join(curr_path, 'data') def tearDown(self): pass - def test_library_file(self): - pass \ No newline at end of file + @classmethod + def tearDownClass(cls): + pass + + def test_convert_part_library(self): + file = 'darpa_template.xlsx' + input_file_path = os.path.join(self.data_dir, file) + template_file = os.path.join(self.data_dir, 'darpa_template_blank.xlsx') + output_doc = tool.convert_part_library(template_file=template_file, input_excel=input_file_path) + self.assertTrue(output_doc) + + dna_parts = output_doc.componentDefinitions + self.assertEqual(5, len(dna_parts)) + + def test_convert_composition_reading(self): + file = 'darpa_template.xlsx' + input_file_path = os.path.join(self.data_dir, file) + template_file = os.path.join(self.data_dir, 'darpa_template_blank.xlsx') + output_doc = tool.convert_composition_reading(template_file=template_file, input_excel=input_file_path) + self.assertTrue(output_doc) diff --git a/excel2sbol/utils/converter_utils.py b/excel2sbol/utils/converter_utils.py index e3a23420..59f6f9ad 100755 --- a/excel2sbol/utils/converter_utils.py +++ b/excel2sbol/utils/converter_utils.py @@ -432,19 +432,19 @@ def read_library(path, start_row, nrows, description_row, use_cols = [0, 1], start_row = 13, nrows = 8, description_row = 9) """ - basic_DNA_parts = pd.read_excel (path, sheet_name = sheet_name, - header= 0, skiprows = start_row) + basic_DNA_parts = pd.read_excel(path, sheet_name=sheet_name, + header=0, skiprows=start_row) - metadata = pd.read_excel (path, sheet_name = sheet_name, - header= None, nrows = nrows, usecols = use_cols) + metadata = pd.read_excel (path, sheet_name=sheet_name, + header=None, nrows=nrows, usecols=use_cols) - description = pd.read_excel (path, sheet_name = sheet_name, skiprows = description_row, - nrows = 1, usecols = description_col) + description = pd.read_excel (path, sheet_name=sheet_name, skiprows=description_row, + nrows=1, usecols=description_col) return (basic_DNA_parts, metadata, description) def quality_check(filled_library, blank_library, filled_metadata, blank_metadata, filled_description, - blank_description, nrows, description_row, description_col=[0], use_cols = [0,1]): + blank_description, nrows, description_row, description_col=[0], use_cols=[0,1]): """ the function compares the edited excel spreadsheet with the template diff --git a/requirements.txt b/requirements.txt index 1f83cd2a..8fef2149 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ sbol2==1.0b8 pandas==1.0.1 numpy==1.18.1 +xlrd >= 1.0.0