def get_extended_sbol(db, part_id, rule = "RFC10"): user_part = db.getUserPart(part_id) print user_part table = user_part["part_type"] model_param = None if table != "Coding": model_param = db.select_with_name(table, user_part["Number"]) component = json.loads(user_part["parts"]) sys_comp = filter(lambda x: x[0:3] == "BBa", component) sys_comp = [find_file(x+".xml", ".") for x in sys_comp] content = union(rule, sys_comp) print content cnt = 0 offset = 0 intermediat = len(getattr(__import__("component_union"), rule).intermediat) for i in xrange(len(component)): if component[i][0:3] == "BBa": content[cnt]["seq"]["bioStart"] += offset content[cnt]["seq"]["bioEnd"] += offset cnt += 1 else: offset += len(component[i]) if i > 0: offset += intermediat header = extend(user_part, model_param) print component dna_sequence = get_new_part_sequence(component, rule) sbol = formatter_v11(content, dna_sequence, header) return sbol
def test(): rule = "RFC25" content = component_union.union(rule, sys.argv[1:]) # path = 'F:/igemgit/project/Python27/web/test/BBa_E1010.xml' # content = component_union.union(rule, path) dna_sequence = component_union.connect(rule, content) sbol = component_union.formatter_v11(content, dna_sequence) print sbol print sequence_serializer.format_to_json(sbol)