Example #1
0
    def refine(self):
        self.init()

        clusterings = self.cluster_splits_of_interest()
        default_clustering_class = constants.merged_default if self.is_merged else constants.single_default

        default_clustering_id = dbops.get_default_clustering_id(
            default_clustering_class, clusterings)

        d = interactive.InputHandler(self.args,
                                     external_clustering={
                                         'clusterings':
                                         clusterings,
                                         'default_clustering':
                                         default_clustering_id
                                     })

        # set a more appropriate title
        bins = sorted(list(self.bins))

        if not self.title:
            self.title = 'Refining %s%s from "%s"' % (
                ', '.join(bins[0:3]), ' (and %d more)' %
                (len(bins) - 3) if len(bins) > 3 else '', self.collection_name)
        d.title = textwrap.fill(self.title)

        return d
Example #2
0
    def get_the_interactive_object(self,
                                   base_path,
                                   title="Unknown Title",
                                   read_only=True):
        """Helper function to get an interactive object that is ready to be launched"""
        args = copy.deepcopy(self.args)
        args.title = title
        args.read_only = read_only

        J = lambda f: os.path.join(base_path, f)
        F = lambda f: J(f) if os.path.exists(J(f)) else None

        args.tree = F('treeFile')
        args.fasta_file = F('fastaFile')
        args.view_data = F('dataFile')
        args.samples_db = F('samples.db')
        args.profile_db = J('profile.db')

        args.samples_information_db = F('samples.db')
        args.additional_layers = F('additionalFile')

        try:
            d = interactive.InputHandler(args)
            return {
                "status": "ok",
                "message": None,
                "data": {
                    "d": d,
                    "args": args
                }
            }
        except Exception, e:
            return {"status": "error", "message": e.e, "data": None}
Example #3
0
    def refine(self):
        self.init()

        clusterings = self.cluster_splits_of_interest()

        d = interactive.InputHandler(self.args,
                                     external_clustering={
                                         'clusterings': clusterings,
                                         'default_clustering': 'tnf-cov'
                                     })

        # set a more appropriate title
        bins = sorted(list(self.bins))
        title = 'Refining %s%s from "%s"' % (
            ', '.join(bins[0:3]), ' (and %d more)' %
            (len(bins) - 3) if len(bins) > 3 else '', self.collection_id)
        d.title = textwrap.fill(title)

        return d