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

enable custom chain mappings in compare-structures action

parent e08c77a2
Branches
Tags
No related merge requests found
...@@ -43,6 +43,10 @@ Example to compute local and per-residue lDDT values as well as QS-score: ...@@ -43,6 +43,10 @@ Example to compute local and per-residue lDDT values as well as QS-score:
ost compare-structures-new -m model.pdb -r reference.cif --lddt --local-lddt \ ost compare-structures-new -m model.pdb -r reference.cif --lddt --local-lddt \
--qs-score --qs-score
Example to inject custom chain mapping
ost compare-structures-new -m model.pdb -r reference.cif -c A:B B:A
""" """
import argparse import argparse
...@@ -149,6 +153,16 @@ def _ParseArgs(): ...@@ -149,6 +153,16 @@ def _ParseArgs():
action="store_true", action="store_true",
help=("Fault tolerant parsing.")) help=("Fault tolerant parsing."))
parser.add_argument(
"-c",
"--chain-mapping",
nargs="+",
dest="chain_mapping",
help=("Custom mapping of chains between the reference and the model. "
"Each separate mapping consist of key:value pairs where key "
"is the chain name in reference and value is the chain name in "
"model."))
parser.add_argument( parser.add_argument(
"--lddt", "--lddt",
dest="lddt", dest="lddt",
...@@ -354,10 +368,14 @@ def _InterfaceResiduesToJSONDict(interface_dict): ...@@ -354,10 +368,14 @@ def _InterfaceResiduesToJSONDict(interface_dict):
def _Process(model, reference, args): def _Process(model, reference, args):
mapping = None
if args.chain_mapping is not None:
mapping = {x.split(':')[0]: x.split(':')[1] for x in args.chain_mapping}
scorer = scoring.Scorer(model, reference, scorer = scoring.Scorer(model, reference,
resnum_alignments = args.residue_number_alignment, resnum_alignments = args.residue_number_alignment,
cad_score_exec = args.cad_exec) cad_score_exec = args.cad_exec,
custom_mapping = mapping)
ir = _GetInconsistentResidues(scorer.aln) ir = _GetInconsistentResidues(scorer.aln)
if len(ir) > 0 and args.enforce_consistency: if len(ir) > 0 and args.enforce_consistency:
...@@ -427,7 +445,6 @@ def _Process(model, reference, args): ...@@ -427,7 +445,6 @@ def _Process(model, reference, args):
io.SavePDB(scorer.model, model.GetName() + args.dump_suffix) io.SavePDB(scorer.model, model.GetName() + args.dump_suffix)
io.SavePDB(scorer.target, reference.GetName() + args.dump_suffix) io.SavePDB(scorer.target, reference.GetName() + args.dump_suffix)
return out return out
def _Main(): def _Main():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment