deps/kb_meme/meme-5.0.1/src/mhmm-state.c
/************************************************************************
 * Copy one state of an MHMM.
 ************************************************************************/
Copy one state of an MHMM.
Copy one state of an MHMM .
static void copy_state
  (MHMM_STATE_T *  a_state,
   MHMM_STATE_T *  new_state)
{
  new_state->type = a_state->type;
  new_state->itrans_out = (int *)mm_malloc(a_state->ntrans_out * sizeof(int));
  new_state->trans_out = allocate_array(a_state->ntrans_out);
  new_state->itrans_in = (int *)mm_malloc(a_state->ntrans_in * sizeof(int));
  new_state->trans_in = allocate_array(a_state->ntrans_in);
  new_state->emit = allocate_array(get_array_length(a_state->emit));
  new_state->emit_odds = allocate_array(get_array_length(a_state->emit_odds));
  new_state->ntrans_out = a_state->ntrans_out;
  copy_int_array(a_state->ntrans_out, 
                 a_state->itrans_out, 
                 new_state->itrans_out);
  copy_array(a_state->trans_out, new_state->trans_out);
  new_state->ntrans_in = a_state->ntrans_in;
  copy_int_array(a_state->ntrans_in,
                 a_state->itrans_in,
                 new_state->itrans_in);
  copy_array(a_state->trans_in, new_state->trans_in);
  copy_array(a_state->emit, new_state->emit);
  copy_array(a_state->emit_odds, new_state->emit_odds);
  new_state->num_sites = a_state->num_sites;
  new_state->i_motif = a_state->i_motif;
  new_state->w_motif = a_state->w_motif;
  strcpy(new_state->motif_id, a_state->motif_id);
  new_state->i_position = a_state->i_position;
  new_state->id_char = a_state->id_char;
}
static void copy_state ( MHMM_STATE_T * a_state , MHMM_STATE_T * new_state ) { new_state -> type = a_state -> type ; new_state -> itrans_out = ( int * ) mm_malloc ( a_state -> ntrans_out * sizeof ( int ) ) ; new_state -> trans_out = allocate_array ( a_state -> ntrans_out ) ; new_state -> itrans_in = ( int * ) mm_malloc ( a_state -> ntrans_in * sizeof ( int ) ) ; new_state -> trans_in = allocate_array ( a_state -> ntrans_in ) ; new_state -> emit = allocate_array ( get_array_length ( a_state -> emit ) ) ; new_state -> emit_odds = allocate_array ( get_array_length ( a_state -> emit_odds ) ) ; new_state -> ntrans_out = a_state -> ntrans_out ; copy_int_array ( a_state -> ntrans_out , a_state -> itrans_out , new_state -> itrans_out ) ; copy_array ( a_state -> trans_out , new_state -> trans_out ) ; new_state -> ntrans_in = a_state -> ntrans_in ; copy_int_array ( a_state -> ntrans_in , a_state -> itrans_in , new_state -> itrans_in ) ; copy_array ( a_state -> trans_in , new_state -> trans_in ) ; copy_array ( a_state -> emit , new_state -> emit ) ; copy_array ( a_state -> emit_odds , new_state -> emit_odds ) ; new_state -> num_sites = a_state -> num_sites ; new_state -> i_motif = a_state -> i_motif ; new_state -> w_motif = a_state -> w_motif ; strcpy ( new_state -> motif_id , a_state -> motif_id ) ; new_state -> i_position = a_state -> i_position ; new_state -> id_char = a_state -> id_char ; }
Copy one state of an MHMM.
Copy one state of an MHMM .
/* Allocate memory. */ /* Outgoing transitions. */ /* Incoming transitions. */ /* Emissions. */ // Descriptive information.