Skip to content

Commit 4b93a37

Browse files
Fix ring_api and parsing of ring output
1 parent 1ef23a7 commit 4b93a37

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def ring_plugin(test=False):
7373

7474
pymol.finish_launching()
7575
cmd.set("defer_builds_mode", 3)
76-
cmd.load("/home/alessio/projects/ring-victor/assets/samples/test.cif")
76+
cmd.load("1JSU.cif")
7777
cmd.dss()
7878
# cmd.show_as("cartoon")
7979
cmd.util.cbc()

main_window.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ def extract_element(atom_name):
369369

370370
edgecolors = np.array(list(colors.values()))
371371
if highlight is not None and len(highlight) > 0:
372-
print(highlight)
373372
edgecolors[highlight] = 'black'
374373

375374
# Visualize the graph
@@ -577,7 +576,7 @@ def run(self):
577576

578577
current_run_config = self.get_current_run_config()
579578

580-
# If Ring has already been run on that obj and the run config didn't changed then just visualize results
579+
# If Ring has already been run on that obj and the run config didn't change then just visualize results
581580
if obj_name in self.prev_launch_config.keys() and self.prev_launch_config[obj_name] == current_run_config \
582581
and not self.widg.override_memory.isChecked():
583582
self.visualize()
@@ -709,10 +708,10 @@ def visualize(self, selection=None, of_type=None):
709708
stored.chain_resi = set()
710709
cmd.iterate(obj, 'stored.chain_resi.add((chain, resi))')
711710
conn_freq = get_freq(stored.model, self.temp_dir.name)
712-
713711
def draw():
714712
interactions_per_state = pd.read_csv(file_pth, sep='\t')
715713

714+
716715
if len(interactions_per_state) == 0:
717716
self.log("No interactions found in the object", warning=True)
718717
return
@@ -734,7 +733,8 @@ def draw():
734733
for int_type in intTypeMap.keys():
735734
interactions_per_type.setdefault(int_type, list())
736735

737-
for (nodeId1, interaction, nodeId2, _, _, _, atom1, atom2, *_) in df.itertuples(index=False):
736+
737+
for (nodeId1, interaction, nodeId2, _, _, atom1, atom2, *_) in df.itertuples(index=False):
738738
int_type, intRegion = interaction.split(":")
739739
node1 = Node(nodeId1)
740740
node2 = Node(nodeId2)
@@ -773,10 +773,12 @@ def draw():
773773
t += (atom1,)
774774
else:
775775
t += ("{}/{}/{}".format(node1.chain, str(node1.resi), atom1),)
776+
776777
if "," in str(atom2):
777778
t += (atom2,)
778779
else:
779780
t += ("{}/{}/{}".format(node2.chain, str(node2.resi), atom2),)
781+
780782
interactions_per_type[int_type].append(t)
781783

782784
# Update set of possible selected nodes

ring_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def run_ring_api(file_pth, run_config, tmp_dir, log_f, progress_f):
152152
job: Job = Job()
153153

154154
file_name = os.path.basename(file_pth)
155+
155156
_log_f(file_pth, file_name)
156157

157158
parameters = {"task": "ring-plugin-api",
@@ -184,6 +185,7 @@ def run_ring_api(file_pth, run_config, tmp_dir, log_f, progress_f):
184185
prev_progress = (prev_progress + 0.00001)
185186

186187
if job.status == "success":
188+
# TODO check the job has not generated an error
187189
_log_f("Computation terminated, downloading results")
188190
else:
189191
_log_f("Error in the execution of RING, please retry later or launch locally", error=True)

utilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def get_node_names_ordered(obj, tmp_dir):
262262

263263
def draw_links(interactions, color, object_name, coords, state):
264264
from pymol import cmd
265-
265+
# print(coords)
266266
tup_color = []
267267
if type(color) is str:
268268
try:
@@ -274,6 +274,7 @@ def draw_links(interactions, color, object_name, coords, state):
274274

275275
obj = [BEGIN, LINES, COLOR] + tup_color
276276
for interaction in interactions:
277+
# print(interaction)
277278
valid = True
278279
if "," in interaction[0]:
279280
coord1 = ([float(x) for x in interaction[0].split(',')],)
@@ -294,7 +295,9 @@ def draw_links(interactions, color, object_name, coords, state):
294295
if valid:
295296
for x, y in zip(coord1, coord2):
296297
obj.extend([VERTEX] + x + [VERTEX] + y)
298+
# print(interaction, coord1, coord2)
297299
obj.append(END)
300+
# print(obj)
298301
cmd.load_cgo(obj, object_name, state=state, zoom=False)
299302

300303

0 commit comments

Comments
 (0)