def __init__(self, aa, loc=None, state=None, test=True): """Init residue object.""" self.aa = normalize_to_set(aa) if loc is not None: self.loc = int(loc) else: self.loc = None self.state = state self.test = normalize_to_set(test)
def meta_data(self): """Get a dictionary with site's meta-data.""" res = dict() if self.interproid: res["interproid"] = self.interproid if self.name: res["name"] = normalize_to_set(self.name) if self.label: res["label"] = normalize_to_set(self.label) return res
def from_json(cls, json_data): """Create Site object from JSON representation.""" name = json_data["name"] test = True if "test" in json_data.keys(): test = normalize_to_set(json_data["test"]) return cls(name, test)
def meta_data(self): """Convert agent object to attrs.""" agent_attrs = { "uniprotid": {self.uniprotid} } if self.hgnc_symbol is not None: agent_attrs["hgnc_symbol"] = normalize_to_set(self.hgnc_symbol) if self.synonyms is not None: agent_attrs["synonyms"] = normalize_to_set(self.synonyms) if self.xrefs is not None: xrefs = [] for k, v in self.xrefs.items(): if type(v) == list: for vv in v: xrefs.append((k, vv)) else: xrefs.append((k, v)) agent_attrs["xrefs"] = normalize_to_set(xrefs) return agent_attrs
def from_json(cls, json_data): """Create Residue object from JSON representation.""" aa = json_data["aa"] loc = None if "loc" in json_data.keys(): loc = json_data["loc"] state = None if "state" in json_data.keys(): state = State.from_json(json_data["state"]) test = True if "test" in json_data.keys(): test = normalize_to_set(json_data["test"]) return cls(aa, loc, state, test)
def meta_data(self): """Convert agent object to attrs.""" return { "name": normalize_to_set(self.name), "test": normalize_to_set(self.test) }