RACIPELIB.c
/*********Preprocess the topology file (.topo) or configure file (.cfg) for RACIPE method*********/
Preprocess the topology file (.topo) or configure file (.cfg) for RACIPE method
Preprocess the topology file ( . topo ) or configure file ( . cfg ) for RACIPE method
void check_inputfile (int argc, char **argv, struct topo *topoinfo, struct opts *simu_opts, struct rlt *tmprlt)
{
  char *token;
  char *fileextension;
  char *inputfile;
  if (argc == 1) {
    printf("### Missing: Missing input file!\n");
    exit(3); 
  }
  else if (argc == 2 && strcmp(argv[1], "-h") == 0){
    printf("Available options:\n");
    printf("-h             : Show all available options.\n");
    printf("-maxtime       : Maximum time for the simulation (Default 23.5 h).\n");
    printf("-solver        : The integrator method (1 --> Euler or 2 --> RK45) to solve the ODEs equations (Default 1).\n");
    printf("-flag          : run RACIPE to produce the .cfg file only or the whole simulation (Default 0, perform the whole simulation).\n");
    printf("-KDID          : Gene or link (See their ID in the .cfg file) to be knocked down.\n");
    printf("-OEID          : Gene (See their ID in the .cfg file) to be overexpressed. (follow by -OEFD).\n");
    printf("-OEFD          : Fold change to overexpress a gene (-OEID must be first set in the option, the value need to be bigger than 1). (Default 1) if the corresponding OEFD is not set, it will be set to 1.\n");
    printf("-DEID          : Gene (See their ID in the .cfg file) to be downexpressed. (follow by -DEFD).\n");
    printf("-DEFD          : Fold change to downexpress a gene (-DEID must be first set in the option, the value need to be bigger than 1). (Default 1) if the corresponding DEFD is not set, it will be set to 1.\n");
    printf("-dist          : Distribution used for randomization\n");
    printf("                 1 ---> Uniform Distribution (Default)\n");
    printf("                 2 ---> Guassian Distribution\n");
    printf("                 3 ---> Exponential Distribution\n");
    printf("-SF            : Scale the distribution ranges of all the parameters except for the hill coefficients, should be smaller than 1 (Default 1).\n");
    printf("-num_findT     : The number of simulations used to estimate the thresholds (Default 10000).\n");
    printf("-num_paras     : The number of RACIPE models to generate (Default 100).\n");
    printf("-num_ode       : The number of Random initial values to solve ODEs (Default 100).\n");
    printf("-num_stability : The maximum number of stable states to save for one RACIPE model (Default 10).\n"); 
    printf("-thrd          : Cutoff for convergence of steady states for numerically solving ODEs (Default 1.0).\n");
    printf("-Toggle_f_p    : Save parameters of each RACIPE model or not (Default 1 (yes)).\n");
    printf("-stepsize      : Stepsize for solving ODEs (Default 0.1).\n");
    printf("-maxiters      : The maximum number of iterations for solving ODEs at each random initial condition times 1000 (Default 20).\n");
    printf("-Toggle_T_test : Test the threshold assumption or not (Default 1 (yes)).\n");
    printf("-SBML_model    : Output a model in the SBML format. The parameter will be the ID of the model (start from 1) to save (Default 0 (no SBML output)).\n");
    printf("-seed          : random seed (Default 1).\n");
    printf("-minP          : Minimum production rate (Default 1.0)\n");
    printf("-maxP          : Maximum production rate (Default 100.0)\n");
    printf("-minK          : Minimum degradation rate (Default 0.1)\n");
    printf("-maxK          : Maximum degradation rate (Default 1.0)\n");
    printf("-minN          : Minimum Hill coefficient (Default 1.0)\n");
    printf("-maxN          : Maximum Hill coefficient (Default 6.0)\n");
    printf("-minF          : Minimum fold change (Default 1.0)\n");
    printf("-maxF          : Maximum fold change (Default 100.0)\n");
    exit(6);
  }
  inputfile = strdup(argv[1]);
  token                   = strtok(inputfile, ".");
  topoinfo->modelname     = strdup(token);
  token                   = strtok(NULL, ".");
  fileextension           = strdup(token);  
  if (strcmp(fileextension, "topo") == 0) {
    simu_opts->exts = 0; 
    initial_simuopts (argc, argv, topoinfo, simu_opts);
    Model_generate   (argv[1], topoinfo, simu_opts, tmprlt);
  }
  else if ((strcmp(fileextension, "cfg") == 0)) {
    simu_opts->exts = 1; 
    read_cfg         (topoinfo, simu_opts, tmprlt);
    initial_simuopts (argc, argv, topoinfo, simu_opts);
    Model_generate   (argv[1], topoinfo, simu_opts, tmprlt);
  }
  else {
    printf("### Wrong: Input file is not recognized. It should be .topo or .cfg file!\n");
    exit(4);
  }
}
void check_inputfile ( int argc , char * * argv , struct topo * topoinfo , struct opts * simu_opts , struct rlt * tmprlt ) { char * token ; char * fileextension ; char * inputfile ; if ( argc == 1 ) { printf ( " \n " ) ; exit ( 3 ) ; } else if ( argc == 2 && strcmp ( argv [ 1 ] , " " ) == 0 ) { printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; printf ( " \n " ) ; exit ( 6 ) ; } inputfile = strdup ( argv [ 1 ] ) ; token = strtok ( inputfile , " " ) ; topoinfo -> modelname = strdup ( token ) ; token = strtok ( NULL , " " ) ; fileextension = strdup ( token ) ; if ( strcmp ( fileextension , " " ) == 0 ) { simu_opts -> exts = 0 ; initial_simuopts ( argc , argv , topoinfo , simu_opts ) ; Model_generate ( argv [ 1 ] , topoinfo , simu_opts , tmprlt ) ; } else if ( ( strcmp ( fileextension , " " ) == 0 ) ) { simu_opts -> exts = 1 ; read_cfg ( topoinfo , simu_opts , tmprlt ) ; initial_simuopts ( argc , argv , topoinfo , simu_opts ) ; Model_generate ( argv [ 1 ] , topoinfo , simu_opts , tmprlt ) ; } else { printf ( " \n " ) ; exit ( 4 ) ; } }
Preprocess the topology file (.topo) or configure file (.cfg) for RACIPE method
Preprocess the topology file ( . topo ) or configure file ( . cfg ) for RACIPE method
// Check the input arguments // Whether .topo or .cfg file is the input file // flag for input file as topo file // flag for input file as cfg file