Esempio n. 1
0
def plasmid_sbol(db, groups, rule="RFC10"):
    circuit = groups["circuit"]
    copy = groups["copy"]
    components = []
    sequence = ""
    offset = 0
    plasmid_backbone = db.getPlasmidBackboneNearValue(copy)["Number"]
    circuit[-1]["sbol"].append({"type": "PlasmidBackbone", "name": plasmid_backbone})
    for data in circuit:
        comp_names = [cc["name"] for cc in data["sbol"]]
        file_list = [find_file(s + ".xml", ".") for s in comp_names]
        sbol = component_union.get_sbol(file_list, rule)
        sbol2 = format_to_json(sbol)
        idx = 0
        for item in sbol2["DnaComponent"]["annotations"]:
            tmp = item["SequenceAnnotation"]
            tmp["subComponent"]["DnaComponent"]["type"] = data["sbol"][idx]["type"]
            tmp["bioStart"] = str(int(tmp["bioStart"]) + offset)
            tmp["bioEnd"] = str(int(tmp["bioEnd"]) + offset)
            idx += 1
        offset += len(sbol2["DnaComponent"]["DnaSequence"]["nucleotides"])
        components += sbol2["DnaComponent"]["annotations"]
        if data["state"] == "trans":
            sequence += trans(sbol2["DnaComponent"]["DnaSequence"]["nucleotides"])
        else:
            sequence += sbol2["DnaComponent"]["DnaSequence"]["nucleotides"]
    sbol2["DnaComponent"]["annotations"] = components
    sbol2["DnaComponent"]["DnaSequence"]["nucleotides"] = sequence
    return sbol2
Esempio n. 2
0
 def getPlasmidSbol_deprecated(self, message):
   sbol = component_union.get_sbol(message["component"], rule)
   ret = format_to_json(sbol)
   return ret