Esempio n. 1
0
    def cluster_contigs(self):
        default_clustering = constants.blank_default if self.blank else constants.single_default

        for config_name in self.clustering_configs:
            config_path = self.clustering_configs[config_name]

            config = ClusteringConfiguration(
                config_path,
                self.output_directory,
                db_paths=self.database_paths,
                row_ids_of_interest=self.split_names)

            try:
                clustering_id, newick = clustering.order_contigs_simple(
                    config,
                    distance=self.distance,
                    linkage=self.linkage,
                    progress=self.progress)
            except Exception as e:
                self.run.warning('Clustering has failed for "%s": "%s"' %
                                 (config_name, e))
                self.progress.end()
                continue

            dbops.add_hierarchical_clustering_to_db(self.profile_db_path, config_name, newick, distance=self.distance, linkage=self.linkage, \
                                                    make_default=config_name == default_clustering, run=self.run)
Esempio n. 2
0
    def cluster_contigs_anvio(self):
        # clustering of contigs is done for each configuration file under static/clusterconfigs/merged directory;
        # at this point we don't care what those recipes really require because we already merged and generated
        # every data file that may be required.

        if not self.skip_hierarchical_clustering:
            for config_name in self.clustering_configs:
                config_path = self.clustering_configs[config_name]

                config = ClusteringConfiguration(
                    config_path,
                    self.output_directory,
                    db_paths=self.database_paths,
                    row_ids_of_interest=self.split_names)

                try:
                    newick = clustering.order_contigs_simple(
                        config, progress=self.progress)
                except Exception as e:
                    self.run.warning('Clustering has failed for "%s": "%s"' %
                                     (config_name, e))
                    self.progress.end()
                    continue

                dbops.add_hierarchical_clustering_to_db(
                    self.profile_db_path,
                    config_name,
                    newick,
                    make_default=config_name == constants.merged_default,
                    run=self.run)
Esempio n. 3
0
    def cluster_contigs(self):
        for config_name in self.clustering_configs:
            config_path = self.clustering_configs[config_name]

            config = ClusteringConfiguration(config_path, self.output_directory, db_paths = self.database_paths, row_ids_of_interest = self.split_names)

            try:
                newick = clustering.order_contigs_simple(config, progress = self.progress)
            except Exception as e:
                self.run.warning('Clustering has failed for "%s": "%s"' % (config_name, e))
                self.progress.end()
                continue

            dbops.add_hierarchical_clustering_to_db(self.profile_db_path, config_name, newick, make_default = config_name == constants.single_default, run = self.run)
Esempio n. 4
0
    def cluster_contigs_anvio(self):
        # clustering of contigs is done for each configuration file under static/clusterconfigs/merged directory;
        # at this point we don't care what those recipes really require because we already merged and generated
        # every metadata file that may be required.
        if not self.skip_hierarchical_clustering:
            for config_name in self.clustering_configs:
                config_path = self.clustering_configs[config_name]

                config = ClusteringConfiguration(config_path, self.output_directory, db_paths = self.database_paths, row_ids_of_interest = self.split_names)

                try:
                    newick = clustering.order_contigs_simple(config, progress = self.progress)
                except Exception as e:
                    self.run.warning('Clustering has failed for "%s": "%s"' % (config_name, e))
                    self.progress.end()
                    continue

                dbops.add_hierarchical_clustering_to_db(self.profile_db_path, config_name, newick, make_default = config_name == constants.merged_default, run = self.run)