aksell commited on
Commit
4501102
·
1 Parent(s): 87df996

Zoom to selected chain if only 1 selected

Browse files
hexviz/🧬Attention_Visualization.py CHANGED
@@ -78,6 +78,10 @@ def get_3dview(pdb):
78
  hidden_chains = [x for x in chains if x not in selected_chains]
79
  for chain in hidden_chains:
80
  xyzview.setStyle({"chain": chain},{"cross":{"hidden":"true"}})
 
 
 
 
81
 
82
  for att_weight, first, second, _, _, _ in attention_pairs:
83
  stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)
 
78
  hidden_chains = [x for x in chains if x not in selected_chains]
79
  for chain in hidden_chains:
80
  xyzview.setStyle({"chain": chain},{"cross":{"hidden":"true"}})
81
+ if len(selected_chains) == 1:
82
+ xyzview.zoomTo({'chain': f'{selected_chains[0]}'})
83
+ else:
84
+ xyzview.zoomTo()
85
 
86
  for att_weight, first, second, _, _, _ in attention_pairs:
87
  stmol.add_cylinder(xyzview, start=first, end=second, cylradius=att_weight, cylColor='red', dashed=False)