/* * Tests for keratinocyte_differentiate() * */ void test_differentiate_stem_z() { //initialise(); char_array * id_temp; id_temp = init_char_array(); add_char(id_temp, '1'); add_keratinocyte_agent(id_temp, K_TYPE_STEM, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); current_xmachine = *p_xmachine; differentiate(); CU_ASSERT_EQUAL(get_type(), K_TYPE_TA); }
void test_start_new_cycle_postion() { int pos; double nonr[1] = {0.2}; char_array * id_temp; //initialise(); // add agent with type stem id_temp = init_char_array(); add_char(id_temp, '1'); add_keratinocyte_agent(id_temp, K_TYPE_STEM, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); current_xmachine = *p_xmachine; //set_non_random(&nonr[0], 1); pos = start_new_cycle_postion(); CU_ASSERT_EQUAL(pos, 6); }
void test_nong0() { const int CYCLE = 10; const int CONTACT_INHIB_TICKS = 10; char_array * id_temp; //initialise(); calcium_level = 0.1; // add agent with 1 bonds in x-y plane, no z bonds, not on edge of substrate id_temp = init_char_array(); add_char(id_temp, '1'); add_keratinocyte_agent(id_temp, K_TYPE_STEM, 10, 10, 0, 0, 0, 0, 1, 0, 0, CYCLE, 0, CONTACT_INHIB_TICKS, 0, 0, 0, 0); current_xmachine = *p_xmachine; cycle(); CU_ASSERT_EQUAL(get_cycle(), CYCLE+1); CU_ASSERT_EQUAL(get_contact_inhibited_ticks(), 0); }
void add_protein(struct char_array_list *proteins, char *start) { struct char_array *protein = malloc(sizeof(struct char_array)); init_char_array(protein); char *codon_start; char c; for (codon_start=start; ; codon_start+=3) { c = aa_at(codon_start); add_char(protein, c); if (c == '\0') { //stop codon - end of protein break; } } cal_add(proteins, protein); }
void test_migrate() { const double DIR = 3.925; // roughly 225 degrees to x axis const double MOTILITY = 1.0; char_array * id_temp; // to prevent dir being changed in migrate double nonr[1] = {0.2}; //set_non_random(&nonr[0], 1); //initialise(); calcium_level = 0.1; // add agent at x=zero y=zero heading of the both x and y edges at 0,0 id_temp = init_char_array(); add_char(id_temp, '1'); add_keratinocyte_agent(id_temp, K_TYPE_TA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MOTILITY, DIR, 0); current_xmachine = *p_xmachine; migrate(); // test that we are still on the substrate CU_ASSERT(get_x() > 0); CU_ASSERT(get_y() > 0); }
int cycle() { xmachine_memory_keratinocyte * xmemory = current_xmachine->xmachine_keratinocyte; char_array id_temp; char buffer[10]; /* find number of contacts/bonds*/ int contacts = get_num_xy_bonds() + get_num_z_bonds(); /* touching a wall counts as two contacts*/ if (get_x() == 0 || get_x() == substrate_width) { contacts += 2; } if (get_y() == 0 || get_y() == substrate_width) { contacts += 2; } if (contacts <= get_max_num_bonds(calcium_level)) { /* cell comes out of G0*/ set_cycle(get_cycle()+1); set_contact_inhibited_ticks(0); } else { /* cell enters G0*/ set_contact_inhibited_ticks(get_contact_inhibited_ticks()+1); } /* check to see if enough time has elapsed as to whether cell can divide*/ if (divide(get_type(), get_cycle())) { int new_cycle = start_new_cycle_postion(); double new_x = get_new_coord(get_x(), FALSE); double new_y = get_new_coord(get_y(), FALSE); double new_z = get_z(); double new_diff_noise_factor = 0.9 + (rnd()*0.2); double new_dir = rnd() * 2 * PI; double new_motility = (0.5 + (rnd() * 0.5)) * get_new_motility(get_type(), calcium_level); last_agent_id ++; /* generate a new ID*/ if (can_stratify(get_type(), calcium_level) && get_num_xy_bonds() >= MAX_NUM_LATERAL_BONDS) { new_z = get_new_coord(get_z(), TRUE); } xmemory->cycle = start_new_cycle_postion(); init_char_array(&id_temp); copy_char_array(&ID_CHAR, &id_temp); add_char(&id_temp, '.'); sprintf(buffer, "%d", SPLITS); add_char(&id_temp, buffer[0]); printf("new cell: %s\n", id_temp.array); add_keratinocyte_agent( /*get_id()+1,*/ ID, &id_temp, /*last_agent_id, id*/ 0, /* splits*/ get_type(), /* type*/ new_x, /* x*/ new_y, /* y*/ new_z, /* z*/ 0, /* force_x*/ 0, /* force_y*/ 0, /* force_z*/ 0, /* num_xy_bonds*/ 0, /* num_z_bonds*/ 0, /* num_stem_bonds*/ new_cycle, /* cycle*/ new_diff_noise_factor, /* diff_noise_factor*/ 0, /* dead_ticks*/ 0, /* contact_inhibited_ticks*/ new_motility, /* motility*/ new_dir, /* dir*/ get_range() /* range */ ); xmemory->splits++; free_char_array(&id_temp); } return 0; }