Skip to content
Snippets Groups Projects
Commit f3501bf0 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

add JSONSummary function to chain_mapping.MappingResult class

parent fa6eb3a0
Branches
Tags
No related merge requests found
...@@ -63,7 +63,7 @@ class MappingResult: ...@@ -63,7 +63,7 @@ class MappingResult:
@property @property
def mapping(self): def mapping(self):
""" Mapping of :attr:`model` chains onto :attr:`~target` """ Mapping of :attr:`~model` chains onto :attr:`~target`
Exact same shape as :attr:`~chem_groups` but containing the names of the Exact same shape as :attr:`~chem_groups` but containing the names of the
mapped chains in :attr:`~model`. May contain None for :attr:`~target` mapped chains in :attr:`~model`. May contain None for :attr:`~target`
...@@ -88,6 +88,21 @@ class MappingResult: ...@@ -88,6 +88,21 @@ class MappingResult:
""" """
return self._alns return self._alns
def JSONSummary(self):
""" Returns JSON serializable summary of results
"""
json_dict = dict()
json_dict["chem_groups"] = self.chem_groups
json_dict["mapping"] = self.mapping
json_dict["alns"] = list()
for aln in self.alns.values():
trg_seq = aln.GetSequence(0)
mdl_seq = aln.GetSequence(1)
aln_dict = {"trg_ch": trg_seq.GetName(), "trg_seq": str(trg_seq),
"mdl_ch": mdl_seq.GetName(), "mdl_seq": str(mdl_seq)}
json_dict["alns"].append(aln_dict)
return json_dict
class ReprResult: class ReprResult:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment