示例#1
0
 def get_clusters(self):
     self.cluster_file_name = self.working_folder + "/cluster.xml"
     self.qmmm_file_name = self.working_folder + "/qmmm.xml"
     ##  write yoink input file to get interactions
     write_yoink_infiles(self.cluster_file_name, self.qmmm_file_name,
                         self.pdb_hierarchy, self.yoink_dat_path)
     self.pyoink.input_file = self.cluster_file_name
     self.pyoink.update()
     self.interaction_list, weight = self.pyoink.get_interactions_list()
     self.interacting_pairs = len(self.interaction_list)
     self.interaction_list += self.backbone_connections
     ## isolate altloc molecules
     new_interaction_list = []
     if (0):
         for item in self.interaction_list:
             contain_altlocs = set(
                 self.altloc_molecular_indices) & set(item)
             if (len(contain_altlocs) == 0):
                 new_interaction_list.append(item)
         self.interaction_list = new_interaction_list
     import clustering
     #t0 = time.time()
     self.clustering = clustering.betweenness_centrality_clustering(
         self.interaction_list,
         size=len(self.pyoink.molecules),
         maxnum_residues_in_cluster=self.maxnum_residues_in_cluster)
     clusters = self.clustering.get_clusters()
     self.clusters = sorted(
         clusters, lambda x, y: 1 if len(x) < len(y) else -1
         if len(x) > len(y) else 0)
示例#2
0
    def get_clusters(self):
        #print(self.clustering)
        n_residues = len(list(self.pdb_hierarchy.residue_groups()))
        if (not self.clustering):
            return (range(1, n_residues + 1, 1))
        if (self.fast_interaction):
            self.interaction_list = pair_interaction.run(
                copy.deepcopy(self.pdb_hierarchy))  ##deepcopy
        else:  # to be deprecated.
            self.cluster_file_name = self.working_folder + "/cluster.xml"
            self.qmmm_file_name = self.working_folder + "/qmmm.xml"
            ##  write yoink input file to get interactions
            if (not self.fast_interaction):
                from qrefine.utils.yoink_utils import write_yoink_infiles
            write_yoink_infiles(self.cluster_file_name, self.qmmm_file_name,
                                self.pdb_hierarchy, self.yoink_dat_path)
            self.pyoink.input_file = self.cluster_file_name
            self.pyoink.update()
            self.interaction_list, weight = self.pyoink.get_interactions_list()

        self.interacting_pairs = len(self.interaction_list)
        self.interaction_list += self.backbone_connections
        ## isolate altloc molecules
        new_interaction_list = []
        if (0):
            for item in self.interaction_list:
                contain_altlocs = set(
                    self.altloc_molecular_indices) & set(item)
                if (len(contain_altlocs) == 0):
                    new_interaction_list.append(item)
            self.interaction_list = new_interaction_list
        import clustering
        # t0 = time.time()
        self.clustering = clustering.betweenness_centrality_clustering(
            self.interaction_list,
            size=n_residues,
            maxnum_residues_in_cluster=self.maxnum_residues_in_cluster)
        clusters = self.clustering.get_clusters()
        self.clusters = sorted(
            clusters, lambda x, y: 1 if len(x) < len(y) else -1
            if len(x) > len(y) else 0)