示例#1
0
    def sim(self):
        self.sim_root()
        for edge in self.edge_list:

            #print edge, self.edge_to_blen[edge]

            # Now need to adapt branchsim
            # create an instance for each branch
            blen = self.edge_to_blen[edge]
            num_exon = self.num_exon
            x_exon = self.x_exon
            x_IGC = deepcopy(self.x_IGC)
            log_file = self.log_folder + '_'.join(edge) + '_log.log'
            div_file = self.div_folder + '_'.join(edge) + '_div.log'
            starting_seq = self.node_to_sequence[edge[0]]

            if edge in self.outgroup:
                x_IGC[0] = 0.0

            self.OneBranchSimulator = OneBranchIGCCodonSimulator(
                blen=blen,
                num_exon=num_exon,
                x_exon=x_exon,
                x_IGC=x_IGC,
                log_file=log_file,
                div_file=div_file,
                initial_seq=starting_seq)

            blen = self.edge_to_blen[edge]

            self.OneBranchSimulator.sim_one_branch(starting_seq, blen)
            self.node_to_sequence[
                edge[1]] = self.OneBranchSimulator.convert_list_to_seq()

            self.total_mut += self.OneBranchSimulator.point_mut_count
            self.total_IGC += self.OneBranchSimulator.IGC_total_count
            self.total_IGC_sites += self.OneBranchSimulator.IGC_contribution_count
            self.total_IGC_changes += self.OneBranchSimulator.IGC_change_sites

        self.output_seq()
        self.get_log()
        self.write_log()