ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/proteinstructure/Pdb.java
(Generate patch)
# Line 219 | Line 219
219                  return dist_matrix;
220          }
221          
222 +        /**
223 +         * Get the contacts for given contact type and cutoff for this Pdb object.
224 +         * Returns a Graph object with the contacts
225 +         * The graph is always directional, i.e. in crossed cases xx/yy: i corresponds to xx and j to yy
226 +         * ct here can be single contact type (e.g. Ca, BB) or crossed (e.g. BB/SC or Ca/Cb)
227 +         * @param ct
228 +         * @param cutoff
229 +         * @return
230 +         */
231          public Graph get_graph(String ct, double cutoff){
232                  TreeMap<Contact,Double> dist_matrix = calculate_dist_matrix(ct);
233                  ArrayList<Contact> contacts = new ArrayList<Contact>();
234 +        // we loop here over all indices of dist_matrix,
235 +        // we took care already that in symmetric cases (i.e. single contact type, not crossed) we have only one side of the matrix and
236 +        // in asymmetrical cases (i.e. crossed cases) we have both sides of the matrix
237                  for (Contact pair:dist_matrix.keySet()){
238                          int i_atomser=pair.i;
239                          int j_atomser=pair.j;
# Line 229 | Line 241
241                                  int i_resser = atomser2resser.get(i_atomser);
242                                  int j_resser = atomser2resser.get(j_atomser);
243                                  Contact resser_pair = new Contact(i_resser,j_resser);
244 +                // for multi-atom models (BB, SC, ALL or BB/SC) we need to make sure that we don't have contacts from residue to itself or that we don't have duplicates                                
245                                  if (i_resser!=j_resser && (! contacts.contains(resser_pair))){
246                                          contacts.add(resser_pair);
247                                  }
248                          }
249                  }
250                  Collections.sort(contacts);
251 <                Graph graph = new Graph (contacts,cutoff,ct);
251 >                TreeMap<Integer,String> nodes = new TreeMap<Integer,String>();
252 >                for (int resser:resser2restype.keySet()){
253 >                        nodes.put(resser,resser2restype.get(resser));
254 >                }
255 >        // NOTE: we pass to the graph object the chain (internal pdbase id) not the pdb chain code!
256 >                Graph graph = new Graph (contacts,nodes,sequence,cutoff,ct,accode,chain);
257                  return graph;
258          }
259          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines