示例#1
0
    def start(self):

        num_cells = len(self.cellList)

        cancer_cell_created = False

        if simulate_flag and template_flag:
            genomes.update(
                load_genomes_into_dict(file_name=TEMPLATES['genome_file']))
            pass

        for cell in self.cellList:
            divisions_left[cell.id] = 0
            divide_times[cell.id] = 0

            cell.targetVolume = GLOBAL['targetVolume']
            cell.lambdaVolume = 1.5

            if simulate_flag and not template_flag:
                genomes[cell.id] = Genome(mutation_rate=1,
                                          name=cell.id,
                                          ploidy_probability=0.0,
                                          ploidy=2)

            # create a cancer cell in the middle
            if not cancer_cell_created and (
                    cell.xCOM <= LATTICE['center_x_max']
                    and cell.xCOM >= LATTICE['center_x_min']) and (
                        cell.yCOM <= LATTICE['center_y_max']
                        and cell.yCOM >= LATTICE['center_y_min']):
                cell.type = self.CANCER2
                cancer_cell_created = True

            if cell.type == self.CANCER2:

                if simulate_flag and not template_flag:
                    genomes[cell.id] = Genome(mutation_rate=10,
                                              name=cell.id,
                                              ploidy_probability=0.0,
                                              ploidy=2)
                else:
                    # this is template flag, therefore we must just update this genomes' attribute.
                    genomes[cell.id].mutation_rate = 10
                    genomes[cell.id].ploidy_probability = 0.0
                    divisions_left[cell.id] = -1  # unlimited cell divisions

            if save_flag:
                trackers['start_tracker'].stash(
                    [cell.id, cell.type, genomes[cell.id].mutation_rate])
            # holder[cell.id] = { 'g': Genome( mutation_rate = 20 , genome_order = 10 ) }

        ## check if we successfully initiated a cancer cell.
        count = 0
        for cell in self.cellList:
            if cell.type == self.CANCER2:
                count += 1

        if count != 1:
            print 'FAILED TO INITIALZE A CANCER CELL.'
            sys.exit(0)
示例#2
0
    def start(self):
        
        num_cells = len(self.cellList)

        # r = np.random.randint(0,num_cells)
        if simulate_flag and template_flag:
            genomes.update( load_genomes_into_dict( file_name = TEMPLATES['genome_file'] ) )
            pass
        for cell in self.cellList:
            
            divide_times[cell.id] = 0
            
            cell.targetVolume=GLOBAL['targetVolume']
            cell.lambdaVolume=1.5

            if simulate_flag and not template_flag:
                genomes[cell.id] = Genome( mutation_rate = 1 , name = cell.id, ploidy_probability=0.0 , ploidy=2 )

            if cell.type == self.CANCER1:

                if simulate_flag and not template_flag:
                    genomes[cell.id] = Genome( mutation_rate = 10 , name = cell.id, ploidy_probability=0.0 , ploidy=2 )

            if save_flag:
                trackers['start_tracker'].stash( [ cell.id, cell.type , genomes[cell.id].mutation_rate ] )    
            # holder[cell.id] = { 'g': Genome( mutation_rate = 20 , genome_order = 10 ) }


        ## check if we successfully initiated a cancer cell.
        count = 0
        for cell in self.cellList:
            if cell.type == self.CANCER1:
                count += 1
    def start(self):
        
        num_cells = len(self.cellList)
        
        cancer_cell_created = False

        if simulate_flag and template_flag:
            genomes.update( load_genomes_into_dict( file_name = TEMPLATES['genome_file'] ) )
            pass

        for cell in self.cellList:
            
            divide_times[cell.id] = 0
            
            cell.targetVolume=GLOBAL['targetVolume']
            cell.lambdaVolume=1.5

            phenotypes[cell.id] = Phenotype( phenotype_template ) # simulate phenotypes

            if simulate_flag and not template_flag:
                genomes[cell.id] = Genome( mutation_rate = 1 , name = cell.id, ploidy_probability=0.0 , ploidy=2 )

            # create a cancer cell in the middle
            if not cancer_cell_created and ( cell.xCOM <= LATTICE['center_x_max'] and cell.xCOM >= LATTICE['center_x_min'] ) and ( cell.yCOM <= LATTICE['center_y_max'] and cell.yCOM >= LATTICE['center_y_min'] ):
                cell.type = self.CANCER1
                cancer_cell_created = True

            if cell.type == self.CANCER1:

                if simulate_flag and not template_flag:
                    genomes[cell.id] = Genome( mutation_rate = 10 , name = cell.id, ploidy_probability=0.0 , ploidy=2 )
                else:
                    # this is template flag, therefore we must just update this genomes' attribute.
                    genomes[cell.id].mutation_rate = 10
                    genomes[cell.id].ploidy_probability = 0.0

            if save_flag:
                trackers['start_tracker'].stash( [ cell.id, cell.type , genomes[cell.id].mutation_rate ] )    
            # holder[cell.id] = { 'g': Genome( mutation_rate = 20 , genome_order = 10 ) }


        ## check if we successfully initiated a cancer cell.
        count = 0
        for cell in self.cellList:
            if cell.type == self.CANCER1:
                count += 1

        if count != 1:
            print 'FAILED TO INITIALZE A CANCER CELL.'
            sys.exit(0)