def test_level_1(self): ''' Test that runs with a single parent-child relationship Expect: Two trees (Two Component Definitions) but with a relationship triplepack This is a component that is a child of one of the CDS ''' # Create SBOL from ShortBOL test_fn = "test_level_1.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),2) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. # The tree has two roots top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,2) self.assertEqual(child_count,1) self.assertEqual(children["http://sbol_prefix.org/pTetR/1"],0) self.assertEqual(children["http://sbol_prefix.org/tetRInverter/1"],1) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,1) self.assertEqual(depths["http://sbol_prefix.org/pTetR/1"],0) self.assertEqual(depths["http://sbol_prefix.org/tetRInverter/1"],1)
def test_non_shortbol_produced_10(self): ''' All previous tests are made from ShortBOL produced SBOL. Should'nt make a difference but potentially some different ways of displaying SBOL. CollectionOutput ''' # Create SBOL from ShortBOL test_fn = "test_non_shortbol_produced_10.rdf" return_code = SBOL2ShortBOL.general_validation(test_fn) self.assertTrue(return_code) test_graph = load_graph(test_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),1) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,1) self.assertEqual(child_count,0) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,0)
def test_large_script_2(self): ''' Tests a large script as almost like a user-test scenario. ''' # Create SBOL from ShortBOL test_fn = "test_large_script_2.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),4) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,4) self.assertEqual(child_count,13) self.assertEqual(children["http://sbol_prefix.org/LacI_inverter/1"],8) self.assertEqual(children["http://sbol_prefix.org/TetR_inverter/1"],5) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,2) self.assertEqual(depths["http://sbol_prefix.org/LacI_inverter/1"],2) self.assertEqual(depths["http://sbol_prefix.org/TetR_inverter/1"],2)
def test_sequence(self): ''' Test Sequences with CD's to ensure that Sequences ARENT identified as children ''' # Create SBOL from ShortBOL test_fn = "test_sequence.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),2) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,2) self.assertEqual(child_count,0) self.assertEqual(children["http://sbol_prefix.org/seq_1/1"],0) self.assertEqual(children["http://sbol_prefix.org/pTetR/1"],0) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,0) self.assertEqual(depths["http://sbol_prefix.org/seq_1/1"],0) self.assertEqual(depths["http://sbol_prefix.org/pTetR/1"],0)
def test_level_2_2(self): ''' Test that runs with GrandParent - Child Relationship Expect: Two trees (Two Component Definitions) with two relationships This is a component that is a child of one of the CDS with a SequenceAnnotation and a child Location. ''' # Create SBOL from ShortBOL test_fn = "test_level_2_2.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),3) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. # The tree has two roots top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,3) self.assertEqual(child_count,5) self.assertEqual(children["http://sbol_prefix.org/cd1/1"],0) self.assertEqual(children["http://sbol_prefix.org/cd2/1"],0) self.assertEqual(children["http://sbol_prefix.org/moduledef_1/1"],5) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,2) self.assertEqual(depths["http://sbol_prefix.org/cd1/1"],0) self.assertEqual(depths["http://sbol_prefix.org/cd2/1"],0) self.assertEqual(depths["http://sbol_prefix.org/moduledef_1/1"],2)
def test_non_sbol_produced(self): # For each example in the examples_dir diff_errors = [] sbol_validation_errors = {} for path, subdirs, files in os.walk(test_files): if "extensions" in path: continue for name in files: if name == "temporary_runner.shb": continue if name.endswith(".xml"): file_to_run = os.path.join(path, name) log_dir = os.path.join(os.getcwd(), name.split(".")[0]) try: os.mkdir(log_dir) except FileExistsError: pass print("\n----------------------------------------") print(f'Running Regression test with {file_to_run}') shortbol_code = os.path.join(log_dir, "shortbol_code.shb") second_rdf_fn = os.path.join(log_dir, "final_output.rdf") try: SBOL2ShortBOL.produce_shortbol(file_to_run, templates, shortbol_code, True) except ValueError: self.fail("Unable to produce the ShortBOL code.") # ShortBOL 2 SBOL - Produce RDF from new ShortBOL. ret_code = produce_sbol(shortbol_code, second_rdf_fn) if not ret_code == {'SBOL validator success.': []}: print( "Test failed due to generated ShortBOL producing Invalid SBOL." ) sbol_validation_errors[file_to_run] = ret_code # Load the original RDF and Newer RDF into a graph and compare. log_fn = os.path.join(log_dir, "error_log.txt") if rdf_difference_check(file_to_run, second_rdf_fn, log_fn): print("Test Passed") shutil.rmtree(log_dir) else: print("Test failed due to differences in SHB files.") diff_errors.append(file_to_run) print("----------------------------------------") if len(list(sbol_validation_errors.keys())) > 0: print("ERROR:: Produced invalid ShortBOL.") for k, v in sbol_validation_errors.items(): print(k, v) if len(diff_errors) != 0: print(f"Regressed with {len(diff_errors)} number of tests") print("ERROR:: Differences found during testing") for e in diff_errors: print(e) self.fail("Failed due to differences")
def test_convert_simple(self): heirachy_tree = { 'http://sbol_prefix.org/tetRInverter/1': [(rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter')), (rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef('http://sbols.org/v2#type'), rdflib.term.URIRef( 'http://www.biopax.org/release/biopax-level3.owl#Dna')), (rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://sbols.org/v2#ComponentDefinition')), (rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef('http://sbols.org/v2#name'), rdflib.term.Literal('name')), (rdflib.term.URIRef('http://sbol_prefix.org/tetRInverter/1'), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('tetRInverter'))], 'http://sbol_prefix.org/pTetR/1': [(rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('pTetR')), (rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef('http://sbols.org/v2#type'), rdflib.term.URIRef( 'http://www.biopax.org/release/biopax-level3.owl#Dna')), (rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef('http://sbol_prefix.org/pTetR')), (rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef('http://sbols.org/v2#role'), rdflib.term.URIRef('http://identifiers.org/so/SO:0000167')), (rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef('http://sbol_prefix.org/pTetR/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://sbols.org/v2#ComponentDefinition'))] } shortbol_code = SBOL2ShortBOL.convert(heirachy_tree, lib_path) summary = summarise_shortbol_code(shortbol_code) self.assertEqual( summary['tetRInverter'], { 'type': 'DNAComponent', 'parameters': [''], 'expansion': { 'name': '"name"' } }) self.assertEqual(summary['pTetR'], { 'type': 'Promoter', 'parameters': [''], 'expansion': {} })
def test_level_0(self): ''' Simplest Test only one triplepack with no children. Expect: Single tree, cd as root with only a single layer that only contains the properties of the CD no children references. ''' # Create SBOL from ShortBOL test_fn = "test_level_0.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),1) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. single_cd = heirachy_tree[str(list(roots)[0][0])] expected_type = (rdflib.URIRef('http://sbol_prefix.org/n/1') , rdflib.URIRef('http://sbols.org/v2#type'), rdflib.URIRef('http://www.biopax.org/release/biopax-level3.owl#Dna')) expected_name = (rdflib.URIRef('http://sbol_prefix.org/n/1') , rdflib.URIRef('http://purl.org/dc/terms/title'), rdflib.term.Literal('LacI CDS')) expected_description = (rdflib.URIRef('http://sbol_prefix.org/n/1') , rdflib.URIRef('http://purl.org/dc/terms/description'), rdflib.term.Literal('Coding Region for LacI protein')) expected_role = (rdflib.URIRef('http://sbol_prefix.org/n/1') , rdflib.URIRef('http://sbols.org/v2#role'), rdflib.URIRef('http://identifiers.org/so/SO:0000316')) self.assertEqual(len(heirachy_tree),1) self.assertTrue(expected_type in single_cd) self.assertTrue(expected_name in single_cd) self.assertTrue(expected_description in single_cd) self.assertTrue(expected_role in single_cd) top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,1) self.assertEqual(child_count,0) self.assertEqual(children["http://sbol_prefix.org/n/1"],0) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,0) self.assertEqual(depths["http://sbol_prefix.org/n/1"],0)
def test_large_script(self): ''' Tests a large script as almost like a user-test scenario. ''' # Create SBOL from ShortBOL test_fn = "test_large_script.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),30) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,30) self.assertEqual(child_count,76) self.assertEqual(children["http://sbol_prefix.org/Gal4VP16_gene/1"],3) self.assertEqual(children["http://sbol_prefix.org/EYFP_gene/1"],3) self.assertEqual(children["http://sbol_prefix.org/gRNA_b_gene/1"],5) self.assertEqual(children["http://sbol_prefix.org/mKate_gene/1"],3) self.assertEqual(children["http://sbol_prefix.org/cas9m_BFP_gene/1"],3) self.assertEqual(children["http://sbol_prefix.org/CRISPR_Template/1"],15) self.assertEqual(children["http://sbol_prefix.org/CRPb_characterization_Circuit/1"],44) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,2) self.assertEqual(depths["http://sbol_prefix.org/Gal4VP16_gene/1"],1) self.assertEqual(depths["http://sbol_prefix.org/EYFP_gene/1"],1) self.assertEqual(depths["http://sbol_prefix.org/gRNA_b_gene/1"],1) self.assertEqual(depths["http://sbol_prefix.org/mKate_gene/1"],1) self.assertEqual(depths["http://sbol_prefix.org/cas9m_BFP_gene/1"],1) self.assertEqual(depths["http://sbol_prefix.org/CRISPR_Template/1"],2) self.assertEqual(depths["http://sbol_prefix.org/CRPb_characterization_Circuit/1"],2)
def test_many_trees_many_relationships(self): ''' Test that runs many top-level objects AND with many relationships but all depth-2 level relationships. Expect: Each Top-Level objects are connected by non-top-level object, parent-child relationships. ''' # Create SBOL from ShortBOL test_fn = "test_many_trees_many_relationships.shb" return_code = shortbol_script_runner.parse_from_file(test_fn,optpaths=[lib_path],out=output_fn) self.assertEqual(list(return_code.keys())[0], "SBOL validator success.") test_graph = load_graph(output_fn) # Run GetRoots roots = SBOL2ShortBOL.find_graph_roots(test_graph) self.assertEqual(len(roots),5) # Test get_tree heirachy_tree = generate_tree(roots,test_graph) SBOL2ShortBOL.tree_dump(heirachy_tree, os.path.join(output_dir,test_fn.split(".")[0] + ".txt")) self.common_tests(heirachy_tree,roots) # Bespoke tests that can only be done by knowledge of the graph. # The tree has two roots top_level_count,children = count_objects(heirachy_tree) child_count = sum(list(children.values())) self.assertEqual(top_level_count,5) self.assertEqual(child_count,6) self.assertEqual(children["http://sbol_prefix.org/seq_1/1"],0) self.assertEqual(children["http://sbol_prefix.org/cd_1/1"],0) self.assertEqual(children["http://sbol_prefix.org/cd_2/1"],4) self.assertEqual(children["http://sbol_prefix.org/model_1/1"],0) self.assertEqual(children["http://sbol_prefix.org/mod_def_1/1"],2) max_depth,depths = get_depth(heirachy_tree) self.assertEqual(max_depth,1) self.assertEqual(depths["http://sbol_prefix.org/seq_1/1"],0) self.assertEqual(depths["http://sbol_prefix.org/cd_1/1"],0) self.assertEqual(depths["http://sbol_prefix.org/cd_2/1"],1) self.assertEqual(depths["http://sbol_prefix.org/model_1/1"],0) self.assertEqual(depths["http://sbol_prefix.org/mod_def_1/1"],1)
def generate_tree(roots,graph): heirachy_tree = {} for root in roots: heirachy_tree[str(root[0])] = SBOL2ShortBOL.get_tree(graph,root[0]) return heirachy_tree
def test_convert_advanced(self): heirachy_tree = { 'http://sbol_prefix.org/LacI_inverter/1': [ { 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1': [(rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib.term.URIRef('http://sbols.org/v2#access'), rdflib.term.URIRef('http://sbols.org/v2#public')), (rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('LacI_fc')), (rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib.term.URIRef('http://sbols.org/v2#definition'), rdflib.term.URIRef('http://sbol_prefix.org/LacI/1')), (rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef( 'http://sbols.org/v2#FunctionalComponent')), (rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacI_fc/1'), rdflib .term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#direction'), rdflib.term.URIRef('http://sbols.org/v2#none'))] }, { 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1': [ { 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1': [ (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib .term.URIRef('http://sbols.org/v2#persistentIdentity' ), rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part' )), ( rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib .term.URIRef('http://sbols.org/v2#participant' ), rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/TetR_fc/1' )), ( rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib .term.URIRef('http://sbols.org/v2#version' ), rdflib.term.Literal('1')), ( rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib.term. URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ), rdflib.term.URIRef( 'http://sbols.org/v2#Participation') ), ( rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib .term.URIRef('http://sbols.org/v2#role'), rdflib.term. URIRef('http://identifiers.org/biomodels.sbo/SBO:0000642' )), ( rdflib.term. URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' ), rdflib.term.URIRef( 'http://sbols.org/v2#displayId' ), rdflib.term.Literal('TetR_lacinv_part')) ] }, { 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1': [(rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib.term.URIRef('http://sbols.org/v2#version' ), rdflib.term.Literal('1')), (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib .term.URIRef('http://sbols.org/v2#persistentIdentity' ), rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part' )), (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib.term.URIRef('http://sbols.org/v2#role'), rdflib. term.URIRef('http://identifiers.org/biomodels.sbo/SBO:0000020' )), (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib .term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ), rdflib .term.URIRef('http://sbols.org/v2#Participation' )), (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib.term.URIRef('http://sbols.org/v2#participant' ), rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacI_fc/1' )), (rdflib .term.URIRef('http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' ), rdflib. term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('LacI_lacinv_part'))] }, (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef('http://sbols.org/v2#type'), rdflib.term.URIRef('http://sbol_prefix.org/inhibition' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef( 'http://sbols.org/v2#persistentIdentity' ), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef('http://sbols.org/v2#version' ), rdflib.term.Literal('1')), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef('http://sbols.org/v2#participation' ), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/TetR_lacinv_part/1' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('LacITetR_int' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef('http://sbols.org/v2#participation' ), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/LacI_lacinv_part/1' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1' ), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ), rdflib.term.URIRef('http://sbols.org/v2#Interaction')) ] }, { 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1': [(rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#direction' ), rdflib.term.URIRef('http://sbols.org/v2#none' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' ), rdflib.term.URIRef( 'http://sbols.org/v2#FunctionalComponent' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef( 'http://sbols.org/v2#persistentIdentity' ), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc' )), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#access'), rdflib.term.URIRef('http://sbols.org/v2#public')), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#definition'), rdflib.term.URIRef('http://sbol_prefix.org/TetR/1')), (rdflib .term.URIRef( 'http://sbol_prefix.org/LacI_inverter/TetR_fc/1' ), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('TetR_fc'))] }, (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef( 'http://sbols.org/v2#displayId'), rdflib.term.Literal('LacI_inverter')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef('http://sbols.org/v2#functionalComponent'), rdflib.term .URIRef('http://sbol_prefix.org/LacI_inverter/TetR_fc/1')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://sbols.org/v2#ModuleDefinition')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef( 'http://sbols.org/v2#interaction'), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacITetR_int/1')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef('http://sbols.org/v2#functionalComponent'), rdflib.term.URIRef( 'http://sbol_prefix.org/LacI_inverter/LacI_fc/1')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI_inverter/1'), rdflib.term.URIRef('http://purl.org/dc/terms/description'), rdflib.term.Literal('LacI inverter')) ], 'http://sbol_prefix.org/TetR/1': [(rdflib.term.URIRef('http://sbol_prefix.org/TetR/1'), rdflib.term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef('http://sbol_prefix.org/TetR')), (rdflib.term.URIRef('http://sbol_prefix.org/TetR/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://sbols.org/v2#ComponentDefinition')), (rdflib.term.URIRef('http://sbol_prefix.org/TetR/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef('http://sbol_prefix.org/TetR/1'), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('TetR')), (rdflib.term.URIRef('http://sbol_prefix.org/TetR/1'), rdflib.term.URIRef('http://sbols.org/v2#type'), rdflib.term.URIRef( 'http://www.biopax.org/release/biopax-level3.owl#Protein'))], 'http://sbol_prefix.org/LacI/1': [(rdflib.term.URIRef('http://sbol_prefix.org/LacI/1'), rdflib.term.URIRef('http://sbols.org/v2#version'), rdflib.term.Literal('1')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI/1'), rdflib.term.URIRef('http://sbols.org/v2#displayId'), rdflib.term.Literal('LacI')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI/1'), rdflib.term.URIRef( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://sbols.org/v2#ComponentDefinition')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI/1'), rdflib.term.URIRef('http://sbols.org/v2#type'), rdflib.term.URIRef( 'http://www.biopax.org/release/biopax-level3.owl#Protein')), (rdflib.term.URIRef('http://sbol_prefix.org/LacI/1'), rdflib.term.URIRef('http://sbols.org/v2#persistentIdentity'), rdflib.term.URIRef('http://sbol_prefix.org/LacI'))] } shortbol_code = SBOL2ShortBOL.convert(heirachy_tree, lib_path) summary = summarise_shortbol_code(shortbol_code) self.assertEqual(summary['TetR'], { 'type': 'ProteinComponent', 'parameters': [''], 'expansion': {} }) self.assertEqual(summary['LacI'], { 'type': 'ProteinComponent', 'parameters': [''], 'expansion': {} }) self.assertEqual(summary['TetR_fc'], { 'type': 'NoneComponent', 'parameters': ['TetR'], 'expansion': {} }) self.assertEqual(summary['LacI_fc'], { 'type': 'NoneComponent', 'parameters': ['LacI'], 'expansion': {} }) self.assertEqual(summary['LacI_lacinv_part'], { 'type': 'Inhibitor', 'parameters': ['LacI_fc'], 'expansion': {} }) self.assertEqual(summary['TetR_lacinv_part'], { 'type': 'Inhibited', 'parameters': ['TetR_fc'], 'expansion': {} }) self.assertEqual( summary['LacITetR_int'], { 'type': 'Interaction', 'parameters': ['inhibition'], 'expansion': { 'participation': 'TetR_lacinv_part', 'participation': 'LacI_lacinv_part' } }) self.assertEqual( summary['LacI_inverter'], { 'type': 'ModuleDefinition', 'parameters': [''], 'expansion': { 'description': '"LacIinverter"', "functionalComponent": "TetR_fc", "functionalComponent": "LacI_fc", "interaction": "LacITetR_int" } })