Пример #1
0
 def __init__(self,
              multilocus_dataset,
              pasta_team,
              tree,
              tmp_base_dir,
              tmp_dir_par=None,
              reset_recursion_index=False,
              skip_merge=False,
              **kwargs):
     self._job_lock = Lock()
     self._merge_queued_event = new_merge_event()
     TickableJob.__init__(self)
     TreeHolder.__init__(self, multilocus_dataset.dataset)
     behavior = copy.copy(PASTAAlignerJob.BEHAVIOUR_DEFAULTS)
     behavior.update(kwargs)
     for k in PASTAAlignerJob.BEHAVIOUR_DEFAULTS.keys():
         setattr(self, k, behavior[k])
     self.multilocus_dataset = multilocus_dataset
     self.pasta_team = pasta_team
     self.tree = tree
     self._subjob1 = None
     self._subjob2 = None
     self._align_job_list = None
     self._merge_job_list = None
     self.tmp_base_dir = tmp_base_dir
     self.context_str = ''
     self.killed = False
     self._dirs_to_cleanup = []
     self.tmp_dir_par = tmp_dir_par
     self.skip_merge = skip_merge
     if self.tmp_dir_par == None:
         self.tmp_dir_par = self.tmp_base_dir
     if reset_recursion_index:
         self.__class__.RECURSION_INDEX = 0
     self.finished = False
Пример #2
0
 def __init__(self, 
             multilocus_dataset, 
             pasta_team, 
             tree,
             tmp_base_dir,
             tmp_dir_par=None,
             reset_recursion_index=False,
             skip_merge = False,
             **kwargs):
     self._job_lock = Lock()
     self._merge_queued_event = new_merge_event()
     TickableJob.__init__(self)
     TreeHolder.__init__(self, multilocus_dataset.dataset)
     behavior = copy.copy(PASTAAlignerJob.BEHAVIOUR_DEFAULTS)
     behavior.update(kwargs)
     for k in PASTAAlignerJob.BEHAVIOUR_DEFAULTS.keys():
         setattr(self, k, behavior[k])
     self.multilocus_dataset = multilocus_dataset
     self.pasta_team = pasta_team
     self.tree = tree
     self._subjob1 = None
     self._subjob2 = None
     self._align_job_list = None
     self._merge_job_list = None
     self.tmp_base_dir = tmp_base_dir
     self.context_str = ''
     self.killed = False
     self._dirs_to_cleanup = []
     self.tmp_dir_par = tmp_dir_par
     self.skip_merge = skip_merge
     if self.tmp_dir_par == None:
         self.tmp_dir_par = self.tmp_base_dir
     if reset_recursion_index:
         self.__class__.RECURSION_INDEX = 0
     self.finished = False
Пример #3
0
    def __init__(self,
                 multilocus_dataset,
                 pasta_team,
                 tree=None,
                 name=None,
                 **kwargs):
        """
        Note that the `tree` will be resolved using DendroPy's resolve_polytomies
            function.
        """
        TreeHolder.__init__(self,
                            multilocus_dataset.dataset,
                            force_fully_resolved=True)
        if tree is not None:
            resolve_polytomies(tree, update_splits=True)

        self.blind_mode_is_final = True
        self.is_stuck_in_blind = False
        behavior = copy.copy(PastaJob.BEHAVIOUR_DEFAULTS)
        behavior.update(PASTAAlignerJob.BEHAVIOUR_DEFAULTS)
        behavior.update(kwargs)
        self.__dict__.update(behavior)

        self.behavior_kws = list(behavior.keys())

        self._job_lock = Lock()
        self.multilocus_dataset = multilocus_dataset
        self.pasta_team = pasta_team
        self.tree = tree
        self.score = kwargs.get('score', None)
        self.best_score = None

        self._tree_build_job = None
        self._pasta_decomp_job = None
        self._reset_jobs()
        self.pastamerge = True

        self._status_message_func = kwargs.get('status_messages')

        # right now max_subproblem_size can be an integer or proportion.
        # These two run modes should be separate parameters!

        # if self.max_subproblem_size <= 1.0:
        #   self.max_subproblem_size *= alignment.get_num_taxa()
        # self.max_subproblem_size = max(1, int(round(self.max_subproblem_size)))

        if isinstance(self.break_strategy, str):
            self.break_strategy = [self.break_strategy]

        self._reset_current_run_settings()
        self.killed = False
Пример #4
0
    def __init__(self,
                 multilocus_dataset,
                 pasta_team,
                 tree,
                 tmp_base_dir,
                 tmp_dir_par=None,
                 reset_recursion_index=False,
                 skip_merge=False,
                 **kwargs):
        self._job_lock = Lock()
        self._merge_queued_event = new_merge_event()
        TickableJob.__init__(self)
        TreeHolder.__init__(self, multilocus_dataset.dataset)
        behavior = copy.copy(PASTAAlignerJob.BEHAVIOUR_DEFAULTS)
        behavior.update(kwargs)

        #modified by uym2 (April 2019)
        #for k in list(PASTAAlignerJob.BEHAVIOUR_DEFAULTS.keys()):
        self.behavior_kws = list(behavior.keys())  # uym2 added (April 2019)
        for k in behavior:
            setattr(self, k, behavior[k])

        # uym2 added (April 2019)
        #self.max_subtree_brlen_frac = self.max_subproblem_size/float(tree.n_leaves)
        #self.max_subtree_brlen = float(self.max_subtree_brlen_frac)*tree.sum_brlen()
        #########################

        self.multilocus_dataset = multilocus_dataset
        self.pasta_team = pasta_team
        self.tree = tree
        _LOG.debug("Number of children of the root at the start: %d" %
                   len(tree._tree.seed_node.child_nodes()))
        self._subjob1 = None
        self._subjob2 = None
        self._align_job_list = None
        self._merge_job_list = None
        self.tmp_base_dir = tmp_base_dir
        self.context_str = ''
        self.killed = False
        self._dirs_to_cleanup = []
        self.tmp_dir_par = tmp_dir_par
        self.skip_merge = skip_merge
        if self.tmp_dir_par == None:
            self.tmp_dir_par = self.tmp_base_dir
        if reset_recursion_index:
            self.__class__.RECURSION_INDEX = 0
        self.finished = False
Пример #5
0
    def __init__(self, multilocus_dataset, pasta_team, tree=None, name=None, **kwargs):
        """
        Note that the `tree` will be resolved using DendroPy's resolve_polytomies
            function.
        """
        TreeHolder.__init__(self,
                            multilocus_dataset.dataset, 
                            force_fully_resolved=True)
        if tree is not None:
            resolve_polytomies(tree, update_splits=True)

        self.blind_mode_is_final = True
        self.is_stuck_in_blind = False
        behavior = copy.copy(PastaJob.BEHAVIOUR_DEFAULTS)
        behavior.update(PASTAAlignerJob.BEHAVIOUR_DEFAULTS)
        behavior.update(kwargs)
        self.__dict__.update(behavior)

        self._job_lock = Lock()
        self.multilocus_dataset = multilocus_dataset
        self.pasta_team = pasta_team
        self.tree = tree
        self.score = kwargs.get('score', None)
        self.best_score = None

        self._tree_build_job = None
        self._pasta_decomp_job = None
        self._reset_jobs()
        self.pastamerge = True

        self._status_message_func = kwargs.get('status_messages')

        # right now max_subproblem_size can be an integer or proportion.
        # These two run modes should be separate parameters!

        # if self.max_subproblem_size <= 1.0:
        #   self.max_subproblem_size *= alignment.get_num_taxa()
        # self.max_subproblem_size = max(1, int(round(self.max_subproblem_size)))

        if isinstance(self.break_strategy, str):
            self.break_strategy = [self.break_strategy]

        self._reset_current_run_settings()
        self.killed = False