1 """@namespace IMP.pmi.io.xltable
2 Tools to plot a contact map overlaid with cross-links.
5 from __future__
import print_function
7 from scipy.spatial.distance
import cdist
9 import matplotlib
as mpl
11 import matplotlib.cm
as cm
12 import matplotlib.pyplot
as plt
14 from collections
import defaultdict
29 """ class to read, analyze, and plot xlink data on contact maps
30 Canonical way to read the data:
31 1) load sequences and name them
32 2) load coordinates for those sequences from PDB file
38 def __init__(self,contact_threshold):
40 self.cross_link_db =
None
41 self.residue_pair_list = []
42 self.distance_maps = []
43 self.contact_freqs =
None
46 self.index_dict = defaultdict(list)
47 self.contact_threshold = contact_threshold
54 def _colormap_distance(self, dist, threshold=35, tolerance=0):
55 if dist < threshold - tolerance:
57 elif dist >= threshold + tolerance:
62 def _colormap_satisfaction(self, sat, threshold=0.5, tolerance=0.1):
63 if sat >= threshold + tolerance:
66 elif sat < threshold + tolerance
and sat >= threshold - tolerance :
73 def _get_percentage_satisfaction(self,r1,c1,r2,c2,threshold=35):
75 idx1=self.index_dict[c1][r1]
79 idx2=self.index_dict[c2][r2]
83 for dists
in self.dist_maps:
85 if dist<threshold: nsatisfied+=1
86 return float(nsatisfied)/len(self.dist_maps)
88 def _get_distance(self,r1,c1,r2,c2):
89 if self.index_dict
is not None:
91 idx1=self.index_dict[c1][r1]
95 idx2=self.index_dict[c2][r2]
98 return self.av_dist_map[idx1,idx2]
100 if (r1,c1,r2,c2)
not in self.stored_dists.keys():
102 selpart=sel.get_selected_particles()
103 selpart_res_one=list(set(self.particles_resolution_one) & set(selpart))
104 if len(selpart_res_one)>1:
return None
105 if len(selpart_res_one)==0:
return None
106 selpart_res_one_1=selpart_res_one[0]
108 selpart=sel.get_selected_particles()
109 selpart_res_one=list(set(self.particles_resolution_one) & set(selpart))
110 if len(selpart_res_one)>1:
return None
111 if len(selpart_res_one)==0:
return None
112 selpart_res_one_2=selpart_res_one[0]
116 self.stored_dists[(r1,c1,r2,c2)]=dist
118 dist=self.stored_dists[(r1,c1,r2,c2)]
124 def _internal_load_maps(self,maps_fn):
125 npzfile = np.load(maps_fn)
126 cname_array=npzfile[
'cname_array']
127 idx_array=npzfile[
'idx_array']
129 for cname,idxs
in zip(cname_array,idx_array):
132 index_dict[cname]=tmp[0:tmp.index(-1)]
134 index_dict[cname]=tmp
135 av_dist_map = npzfile[
'av_dist_map']
136 contact_map = npzfile[
'contact_map']
137 return index_dict,av_dist_map,contact_map
140 """ read sequence. structures are displayed in the same order as sequences are read.
141 fasta_file: file to read
142 id_in_fasta_file: id of desired sequence
143 protein_name: identifier for this sequence (use same name when handling coordinates)
144 can provide the fasta name (for retrieval) and the protein name (for storage) """
147 if id_in_fasta_file
is None:
148 id_in_fasta_file = name
149 if id_in_fasta_file
not in record_dict:
150 raise KeyError(
"id %s not found in fasta file" % id_in_fasta_file)
151 length = len(record_dict[id_in_fasta_file])
153 self.sequence_dict[protein_name] = str(record_dict[id_in_fasta_file])
156 """ read coordinates from a pdb file. also appends to distance maps
157 @param pdbfile file for reading coords
158 @param chain_to_name_map correspond chain ID with protein name (will ONLY read these chains)
159 Key: PDB chain ID. Value: Protein name (set in sequence reading)
160 \note This function returns an error if the sequence for each chain has NOT been read
163 total_len = sum(len(self.sequence_dict[s])
for s
in self.sequence_dict)
164 coords = np.ones((total_len,3)) * 1e5
166 for cid
in chain_to_name_map:
167 cname = chain_to_name_map[cid]
168 if cname
not in self.sequence_dict:
169 print(
"ERROR: chain",cname,
'has not been read or has a naming mismatch')
172 self.index_dict[cname]=range(prev_stop,prev_stop+len(self.sequence_dict[cname]))
174 for p
in sel.get_selected_particles():
176 coords[rnum+prev_stop-1,:] = list(
IMP.core.XYZ(p).get_coordinates())
177 prev_stop+=len(self.sequence_dict[cname])
178 dists = cdist(coords, coords)
179 binary_dists = np.where((dists <= self.contact_threshold) & (dists >= 1.0), 1.0, 0.0)
181 self.dist_maps= [dists]
182 self.av_dist_map = dists
183 self.contact_freqs = binary_dists
186 self.dist_maps.append(dists)
187 self.av_dist_map += dists
188 self.contact_freqs += binary_dists
194 """ read coordinates from a rmf file. It needs IMP to run.
195 rmf has been created using IMP.pmi conventions. It gets the
196 highest resolution automatically. Also appends to distance maps
197 @param rmf_name file for reading coords
198 @param rmf_frame_index frame index from the rmf
199 @param nomap Default False, if True it will not calculate the contact map
201 (particles_resolution_one, prots)=self._get_rmf_structure(rmf_name,rmf_frame_index)
203 total_len = sum(len(self.sequence_dict[s])
for s
in self.sequence_dict)
204 print(self.sequence_dict,total_len)
206 coords = np.ones((total_len,3)) * 1e6
208 sorted_particles=IMP.pmi.tools.sort_by_residues(particles_resolution_one)
211 self.particles_resolution_one=particles_resolution_one
216 for cname
in chain_names:
219 self.index_dict[cname]=range(prev_stop,prev_stop+len(self.sequence_dict[cname]))
220 rindexes=range(1,len(self.sequence_dict[cname])+1)
221 for rnum
in rindexes:
223 selpart=sel.get_selected_particles()
224 selpart_res_one=list(set(particles_resolution_one) & set(selpart))
225 if len(selpart_res_one)>1:
continue
226 if len(selpart_res_one)==0:
continue
227 selpart_res_one=selpart_res_one[0]
229 coords[rnum+prev_stop-1,:]=
IMP.core.XYZ(selpart_res_one).get_coordinates()
231 print(
"Error: exceed max size",prev_stop,total_len,cname,rnum)
233 prev_stop+=len(self.sequence_dict[cname])
234 dists = cdist(coords, coords)
235 binary_dists = np.where((dists <= self.contact_threshold) & (dists >= 1.0), 1.0, 0.0)
237 self.dist_maps= [dists]
238 self.av_dist_map = dists
239 self.contact_freqs = binary_dists
242 self.dist_maps.append(dists)
243 self.av_dist_map += dists
244 self.contact_freqs += binary_dists
248 def _get_rmf_structure(self,rmf_name,rmf_frame_index):
249 rh= RMF.open_rmf_file_read_only(rmf_name)
252 print(
"getting coordinates for frame %i rmf file %s" % (rmf_frame_index, rmf_name))
257 protein_names=particle_dict.keys()
258 particles_resolution_one=[]
259 for k
in particle_dict:
260 particles_resolution_one+=(particle_dict[k])
262 return particles_resolution_one, prots
265 def save_maps(self,maps_fn):
266 maxlen=max(len(self.index_dict[key])
for key
in self.index_dict)
269 for cname,idx
in self.index_dict.iteritems():
271 idxs.append(idx+[-1]*(maxlen-len(idx)))
272 idx_array=np.array(idxs)
273 cname_array=np.array(cnames)
275 cname_array=cname_array,
277 av_dist_map=self.av_dist_map,
278 contact_map=self.contact_freqs)
280 def load_maps(self,maps_fn):
281 self.index_dict,self.av_dist_map,self.contact_freqs=self._internal_load_maps(maps_fn)
284 """ read crosslinks from a CSV file.
285 provide a CrossLinkDataBaseKeywordsConverter to explain the columns
286 @distance_field is the optional keyword for the distance to be read form the file.
287 This can skip the rmf reading to calculate the distance of cross-links if
288 already provided in the csv file."""
289 if type(CrossLinkDataBase)
is not IMP.pmi.io.crosslink.CrossLinkDataBase:
290 raise TypeError(
"Crosslink database must be a IMP.pmi.io.CrossLinkDataBase type")
291 self.cross_link_db=CrossLinkDataBase
292 if distance_field
is not None:
293 total_len = sum(len(self.sequence_dict[s])
for s
in self.sequence_dict)
294 zeros = np.zeros((total_len,3))
295 self.av_dist_map = cdist(zeros,zeros)
296 for xl
in self.cross_link_db:
297 c1=xl[self.cross_link_db.protein1_key]
298 c2=xl[self.cross_link_db.protein2_key]
299 r1=xl[self.cross_link_db.residue1_key]
300 r2=xl[self.cross_link_db.residue2_key]
302 self.stored_dists[(r1,c1,r2,c2)]=float(xl[distance_field])
303 self.stored_dists[(r2,c2,r1,c1)]=float(xl[distance_field])
305 self.stored_dists[(r1,c1,r2,c2)]=10e6
306 self.stored_dists[(r2,c2,r1,c1)]=10e6
308 for xl
in self.cross_link_db:
309 c1=xl[self.cross_link_db.protein1_key]
310 c2=xl[self.cross_link_db.protein2_key]
311 r1=xl[self.cross_link_db.residue1_key]
312 r2=xl[self.cross_link_db.residue2_key]
313 self.stored_dists[(r1,c1,r2,c2)]=self._get_distance(r1,c1,r2,c2)
314 self.stored_dists[(r2,c2,r1,c1)]=self._get_distance(r2,c2,r1,c1)
317 """ select the atom names of residue pairs to plot on the contact map
318 list of residues types must be single letter code
319 e.g. residue_type_pair=("K","K")
321 rtp=sorted(residue_type_pair)
322 for prot1
in self.sequence_dict:
323 seq1=self.sequence_dict[prot1]
324 for nres1,res1
in enumerate(seq1):
325 for prot2
in self.sequence_dict:
326 seq2=self.sequence_dict[prot2]
327 for nres2,res2
in enumerate(seq2):
328 if sorted((res1,res2))==rtp:
329 self.residue_pair_list.append((nres1+1,prot1,nres2+1,prot2))
332 """ loop through each distance map and get frequency of contacts
334 if self.num_pdbs!=0
and self.num_rmfs==0:
335 self.av_dist_map = 1.0/self.num_pdbs * self.av_dist_map
336 self.contact_freqs = 1.0/self.num_pdbs * self.contact_freqs
337 if self.num_pdbs==0
and self.num_rmfs!=0:
338 self.av_dist_map = 1.0/self.num_rmfs * self.av_dist_map
339 self.contact_freqs = 1.0/self.num_rmfs * self.contact_freqs
341 def setup_difference_map(self,maps_fn1,maps_fn2,thresh):
342 idx1,av1,contact1=self._internal_load_maps(maps_fn1)
343 idx2,av2,contact2=self._internal_load_maps(maps_fn2)
345 print(
"UH OH: index dictionaries do not match!")
353 elif c1>thresh
and c2<thresh:
355 elif c1<thresh
and c2>thresh:
359 f = np.vectorize(logic,otypes=[np.int])
360 print(
'computing contact map')
361 self.contact_freqs = f(contact1,contact2)
366 def spring_layout(self,ax,plt,data, annotations, iterations = 100, k=1):
368 import networkx
as nx
376 Author: G. Bouvier, Pasteur Institute, Paris
377 Website: http://bloggb.fr/2015/10/19/spring_layout_for_annotating_plot_in_matplotlib.html
378 - data: coordinates of your points [(x1,y1), (x2,y2), ..., (xn,yn)]
379 - annotations: text for your annotation ['str_1', 'str_2', ..., 'str_n']
380 - iterations: number of iterations for spring layout
381 - k: optimal distance between nodes
385 x, y = [e[0]
for e
in data], [e[1]
for e
in data]
386 xmin, xmax = min(x), max(x)
387 ymin, ymax = min(y), max(y)
396 for i,xy
in enumerate(data):
423 ps = particles.values()+particles_fixed.values()
430 rs.add_restraint(evr)
434 #G.add_edge(xy, text)
437 delTri = scipy.spatial.Delaunay(data)
438 #plt.scatter([e[0] for e in data], [e[1] for e in data])
439 # create a set for edges that are indexes of the points
441 # for each Delaunay triangle
442 for n in xrange(delTri.nsimplex):
443 # for each edge of the triangle
445 # (sorting avoids duplicated edges being added to the set)
446 # and add to the edges set
447 edge = sorted([delTri.vertices[n,0], delTri.vertices[n,1]])
448 edges.add((edge[0], edge[1]))
449 edge = sorted([delTri.vertices[n,0], delTri.vertices[n,2]])
450 edges.add((edge[0], edge[1]))
451 edge = sorted([delTri.vertices[n,1], delTri.vertices[n,2]])
452 edges.add((edge[0], edge[1]))
456 G.add_edge(e[0],e[1])
458 d1=IMP.core.XYZ(particles[e[0]])
459 d2=IMP.core.XYZ(particles[e[1]])
460 dist=IMP.core.get_distance(d1,d2)
461 ts1 = IMP.core.Harmonic(dist+150, 0.001)
463 IMP.core.DistanceRestraint(m, ts1,
471 mc.set_scoring_function(rs)
472 mc.set_return_best(
False)
478 pos = nx.spring_layout(G ,pos=init_pos)
481 for i,xy in enumerate(data):
482 xynew = pos[i] * [xmax-xmin, ymax-ymin] + [xmin, ymin]
483 plt.plot((xy[0],xynew[0]), (xy[1],xynew[1]), 'k-')
484 x_list.append(xynew[0])
485 y_list.append(xynew[1])
486 #plt.annotate(name, xy, size=5, xycoords='data', xytext=xytext, textcoords='data', bbox=dict(boxstyle='round,pad=0.2', fc='yellow', alpha=0.3),\
487 # arrowprops=dict(arrowstyle="-", connectionstyle="arc3", color='gray'))
489 points=ax.scatter(x_list,y_list,alpha=1)
490 #pos*=[numpy.ptp([e[0] for e in data]), numpy.ptp([e[1] for e in data])]
496 mc.optimize(1000*len(particles.keys())*2)
497 print(rs.evaluate(
False))
500 for i,xy
in enumerate(data):
503 xynew = (coord[0],coord[1])
504 plt.plot((xy[0],xynew[0]), (xy[1],xynew[1]),
'k-')
505 x_list.append(xynew[0])
506 y_list.append(xynew[1])
507 points=ax.scatter(x_list,y_list,alpha=1,facecolors=
'none', edgecolors=
'k')
512 def show_mpld3(self,fig,ax,points,xl_list,xl_labels):
514 from mpld3
import plugins
521 border-collapse: collapse;
526 background-color: #ffffff;
530 background-color: #cccccc;
534 font-family:Arial, Helvetica, sans-serif;
535 border: 1px solid black;
540 df = pd.DataFrame(index=xl_labels)
542 sorted_keys=sorted(xl_list[0].keys())
544 for k
in sorted_keys:
545 df[k] = np.array([xl[k]
for xl
in xl_list])
548 for i
in range(len(xl_labels)):
549 label = df.ix[[i], :].T
551 labels.append(str(label.to_html()))
553 tooltip = plugins.PointHTMLTooltip(points, labels,
554 voffset=10, hoffset=10, css=css)
555 plugins.connect(fig, tooltip)
556 mpld3.save_html(fig,
"output.html")
559 def get_residue_contacts(self,prot_listx,prot_listy):
560 for px
in prot_listx:
561 for py
in prot_listy:
562 indexes_x = self.index_dict[px]
563 minx = min(indexes_x)
564 maxx = max(indexes_x)
565 indexes_y = self.index_dict[py]
566 miny = min(indexes_y)
567 maxy = max(indexes_y)
568 array = self.contact_freqs[minx:maxx,miny:maxy]
569 (xresidues,yresidues)=np.where(array>0)
570 for n,xr
in enumerate(xresidues):
571 print(xr,yresidues[n],px,py,array[xr,yresidues[n]])
577 confidence_info=
False,
579 display_residue_pairs=
False,
582 confidence_classes=
None,
584 scale_symbol_size=1.0,
585 gap_between_components=0,
586 dictionary_of_gaps={},
588 crosslink_threshold=
None,
593 color_crosslinks_by_distance=
True):
594 """ plot the xlink table with optional contact map.
595 prot_listx: list of protein names on the x-axis
596 prot_listy: list of protein names on the y-axis
597 no_dist_info: plot only the cross-links as grey spots
599 filter: list of tuples to filter on. each one contains:
600 keyword in the database to be filtered on
601 relationship ">","==","<"
603 example ("ID_Score",">",40)
604 display_residue_pairs: display all pairs defined in self.residue_pair_list
605 contactmap: display the contact map
606 filename: save to file (adds .pdf extension)
609 scale_symbol_size: rescale the symbol for the crosslink
610 gap_between_components: the numbeber of residues to leave blannk between each component
611 dictionary_of_gaps: add extra space after the given protein. dictionary_of_gaps={prot_name:extra_gap}
616 fig = plt.figure(figsize=(100, 100))
617 ax = fig.add_subplot(111)
621 if cbar_labels
is not None:
622 if len(cbar_labels)!=4:
623 print(
"to provide cbar labels, give 3 fields (first=first input file, last=last input) in oppose order of input contact maps")
626 if prot_listx
is None:
627 prot_listx = self.sequence_dict.keys()
629 nresx = gap_between_components + \
630 sum([len(self.sequence_dict[name])
631 + gap_between_components
for name
in prot_listx]) + \
632 sum([dictionary_of_gaps[prot]
for prot
in dictionary_of_gaps.keys()])
635 if prot_listy
is None:
636 prot_listy = self.sequence_dict.keys()
638 nresy = gap_between_components + \
639 sum([len(self.sequence_dict[name])
640 + gap_between_components
for name
in prot_listy]) + \
641 sum([dictionary_of_gaps[prot]
for prot
in dictionary_of_gaps.keys()])
646 res = gap_between_components
647 for prot
in prot_listx:
648 resoffsetx[prot] = res
649 res += len(self.sequence_dict[prot])
651 res += gap_between_components
652 if prot
in dictionary_of_gaps.keys(): res+= dictionary_of_gaps[prot]
656 res = gap_between_components
657 for prot
in prot_listy:
658 resoffsety[prot] = res
659 res += len(self.sequence_dict[prot])
661 res += gap_between_components
662 if prot
in dictionary_of_gaps.keys(): res+= dictionary_of_gaps[prot]
664 resoffsetdiagonal = {}
665 res = gap_between_components
666 for prot
in IMP.pmi.io.utilities.OrderedSet(prot_listx + prot_listy):
667 resoffsetdiagonal[prot] = res
668 res += len(self.sequence_dict[prot])
669 res += gap_between_components
670 if prot
in dictionary_of_gaps.keys(): res+= dictionary_of_gaps[prot]
675 for n, prot
in enumerate(prot_listx):
676 res = resoffsetx[prot]
678 for proty
in prot_listy:
679 resy = resoffsety[proty]
680 endy = resendy[proty]
681 ax.plot([res, res], [resy, endy], linestyle=
'-',color=
'gray', lw=0.4)
682 ax.plot([end, end], [resy, endy], linestyle=
'-',color=
'gray', lw=0.4)
683 xticks.append((float(res) + float(end)) / 2)
688 for n, prot
in enumerate(prot_listy):
689 res = resoffsety[prot]
691 for protx
in prot_listx:
692 resx = resoffsetx[protx]
693 endx = resendx[protx]
694 ax.plot([resx, endx], [res, res], linestyle=
'-',color=
'gray', lw=0.4)
695 ax.plot([resx, endx], [end, end], linestyle=
'-',color=
'gray', lw=0.4)
696 yticks.append((float(res) + float(end)) / 2)
701 tmp_array = np.zeros((nresx, nresy))
702 for px
in prot_listx:
703 for py
in prot_listy:
704 resx = resoffsetx[px]
705 lengx = resendx[px] - 1
706 resy = resoffsety[py]
707 lengy = resendy[py] - 1
708 indexes_x = self.index_dict[px]
709 minx = min(indexes_x)
710 maxx = max(indexes_x)
711 indexes_y = self.index_dict[py]
712 miny = min(indexes_y)
713 maxy = max(indexes_y)
714 tmp_array[resx:lengx,resy:lengy] = self.contact_freqs[minx:maxx,miny:maxy]
716 cax = ax.imshow(tmp_array,
721 interpolation=
'nearest')
723 ax.set_xticks(xticks)
724 ax.set_xticklabels(xlabels, rotation=90)
725 ax.set_yticks(yticks)
726 ax.set_yticklabels(ylabels)
727 plt.setp(ax.get_xticklabels(), fontsize=6)
728 plt.setp(ax.get_yticklabels(), fontsize=6)
731 already_added_xls = []
732 xl_coordinates_tuple_list = []
739 markersize = 5 * scale_symbol_size
740 if self.cross_link_db:
741 for xl
in self.cross_link_db:
743 (c1,c2,r1,r2)=IMP.pmi.io.crosslink._ProteinsResiduesArray(xl)
744 label=xl[self.cross_link_db.unique_sub_id_key]
745 if color_crosslinks_by_distance:
748 mdist=self._get_distance(r1,c1,r2,c2)
749 if mdist
is None:
continue
750 color = self._colormap_distance(mdist,threshold=crosslink_threshold)
757 ps=self._get_percentage_satisfaction(r1,c1,r2,c2)
758 if ps
is None:
continue
759 color = self._colormap_satisfaction(ps,threshold=0.2,tolerance=0.1)
764 pos1 = r1 + resoffsetx[c1]
768 pos2 = r2 + resoffsety[c2]
775 pos_for_diagonal1 = r1 + resoffsetdiagonal[c1]
776 pos_for_diagonal2 = r2 + resoffsetdiagonal[c2]
778 if confidence ==
'0.01':
779 markersize = 14 * scale_symbol_size
780 elif confidence ==
'0.05':
781 markersize = 9 * scale_symbol_size
782 elif confidence ==
'0.1':
783 markersize = 6 * scale_symbol_size
785 markersize = 15 * scale_symbol_size
787 markersize = 5 * scale_symbol_size
794 markersize=markersize)
801 markersize=markersize)
807 color_list.append(color)
808 color_list.append(color)
813 xl_labels.append(label)
814 xl_coordinates_tuple_list.append((float(pos1),float(pos2)))
815 xl_labels.append(label+
"*")
816 xl_coordinates_tuple_list.append((float(pos2),float(pos1)))
818 points=ax.scatter(x_list,y_list,s=markersize,c=color_list,alpha=alphablend)
821 if display_residue_pairs:
822 for rp
in self.residue_pair_list:
829 dist=self._get_distance(r1,c1,r2,c2)
836 pos1 = r1 + resoffsetx[c1]
840 pos2 = r2 + resoffsety[c2]
849 markersize=markersize)
852 fig.set_size_inches(0.002 * nresx, 0.002 * nresy)
853 [i.set_linewidth(2.0)
for i
in ax.spines.itervalues()]
854 if cbar_labels
is not None:
855 cbar = fig.colorbar(cax, ticks=[0.5,1.5,2.5,3.5])
856 cbar.ax.set_yticklabels(cbar_labels)
860 points=self.spring_layout(ax,plt,xl_coordinates_tuple_list, xl_labels)
864 plt.savefig(filename, dpi=300,transparent=
"False")
868 self.show_mpld3(fig,ax,points,xl_list,xl_labels)
Utility classes and functions for IO.
atom::Hierarchies create_hierarchies(RMF::FileConstHandle fh, Model *m)
Set of python classes to create a multi-state, multi-resolution IMP hierarchy.
Upper bound harmonic function (non-zero when feature > mean)
class to read, analyze, and plot xlink data on contact maps Canonical way to read the data: 1) load s...
static XYZR setup_particle(Model *m, ParticleIndex pi)
Utility classes and functions for reading and storing PMI files.
def plot_table
plot the xlink table with optional contact map.
def load_rmf_coordinates
read coordinates from a rmf file.
Handles cross-link data sets.
Return all close unordered pairs of particles taken from the SingletonContainer.
def load_pdb_coordinates
read coordinates from a pdb file.
Distance restraint between two particles.
double get_distance(XYZR a, XYZR b)
Compute the sphere distance between a and b.
void read_pdb(TextInput input, int model, Hierarchy h)
Object used to hold a set of restraints.
def setup_contact_map
loop through each distance map and get frequency of contacts
Class for storing model, its restraints, constraints, and particles.
def load_sequence_from_fasta_file
read sequence.
ParticleIndexPairs get_indexes(const ParticlePairsTemp &ps)
def set_residue_pairs_to_display
select the atom names of residue pairs to plot on the contact map list of residues types must be sing...
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
Store a list of ParticleIndexes.
A decorator for a particle representing an atom.
def load_crosslinks
read crosslinks from a CSV file.
void load_frame(RMF::FileConstHandle file, RMF::FrameID frame)
Load the given RMF frame into the state of the linked objects.
A decorator for a particle with x,y,z coordinates.
def get_particles_at_resolution_one
Get particles at res 1, or any beads, based on the name.
Tools for clustering and cluster analysis.
Modify a set of continuous variables using a normal distribution.
Residue get_residue(Atom d, bool nothrow=false)
Return the Residue containing this atom.
Class to handle individual particles of a Model object.
Select all CA ATOM records.
static const FloatKeys & get_xyz_keys()
Get a vector containing the keys for x,y,z.
Python classes to represent, score, sample and analyze models.
A dictionary-like wrapper for reading and storing sequence data.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
Support for the RMF file format for storing hierarchical molecular data and markup.
Applies a list of movers one at a time.
Applies a PairScore to each Pair in a list.
Perform more efficient close pair finding when rigid bodies are involved.
A decorator for a particle with x,y,z coordinates and a radius.