Exemplo n.º 1
0
int main(int argc, Char *argv[])
{  /* Read in sequences or frequencies and bootstrap or jackknife them */
#ifdef MAC
  argc = 1;                /* macsetup("SeqBoot","");                */
  argv[0] = "SeqBoot";
#endif
  init(argc,argv);
  openfile(&infile, INFILE, "input file", "r", argv[0], infilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  doinput(argc, argv);
  bootwrite();
  
  freenewer();
  freenew();
  freerest();

  if (nodep)
    matrix_char_delete(nodep, spp);
  if (nodef)
    matrix_double_delete(nodef, spp);

  FClose(infile);
  if (factors) {
    FClose(factfile);
    FClose(outfactfile);
  }
  if (weights)
    FClose(weightfile);
  if (categories) {
    FClose(catfile);
    FClose(outcatfile);
  }
  if(mixture)
    FClose(outmixfile);
  if(ancvar)
    FClose(outancfile);
  if (justwts && !permute) {
    FClose(outweightfile);
  }
  else
    FClose(outfile);
#ifdef MAC
  fixmacfile(outfilename);
  if (justwts && !permute)
    fixmacfile(outweightfilename);
  if (categories)
    fixmacfile(outcatfilename);
  if (mixture)
    fixmacfile(outmixfilename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Exemplo n.º 2
0
int main(int argc, Char *argv[])
{   /* Read in sequences or frequencies and bootstrap or jackknife them */
    init(argc,argv);
    openfile(&infile, argv[1], "input file", "r", argv[0], infilename);
    reps = atol(argv[2]);
    doinput(argc, argv);
    bootwrite();

    freenewer();
    freenew();
    freerest();

    if (nodep)
        matrix_char_delete(nodep, spp);

    FClose(infile);

    return 0;
}
Exemplo n.º 3
0
int main(int argc, Char *argv[])
{  /* main program */
#ifdef MAC
  argc = 1;                /* macsetup("Neighbor","");                */
  argv[0] = "Neighbor";
#endif
  init(argc, argv);
  openfile(&infile,INFILE,"input file", "r",argv[0],infilename);
  openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  mulsets = false;
  datasets = 1;
  doinit();
  if (trout)
    openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename);
  ith = 1;
  while (ith <= datasets) {
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n",ith);
      if (progress)
        printf("Data set # %ld:\n",ith);
    }
    inputoptions();
    maketree();
    if (eoln(infile) && (ith < datasets)) 
      scan_eoln(infile);
    ith++;
  }
  FClose(infile);
  FClose(outfile);
  FClose(outtree);
  freerest();
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Exemplo n.º 4
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{  /* main program */
  double *outputval, *inputval;
  int mrows, ncols;

      if (nrhs != 1) {
        mexPrintf("Format for calling 'NEIGHBOR' executable:\n");
        mexPrintf("\tNEIGHBOR( <outgrno> )\n");
        mexErrMsgTxt("Wrong number of input args.");
    }

    /* Read in the argument: either a double or NULL '[]' */
    if (((mxIsDouble(prhs[0]) != 1) & (!mxIsEmpty(prhs[0]))) == 1) {
        mexErrMsgTxt("The argument should be a double.\n");
    }
    else if (((mxIsDouble(prhs[0]) == 1) & (!mxIsEmpty(prhs[0])) == 1)) {
        mrows = mxGetM(prhs[0]);
        ncols = mxGetN(prhs[0]);
        if ((mrows * ncols) > 1)
            mexErrMsgTxt("The argument should be a single value.\n");
        else {            
            inputval = mxGetPr(prhs[0]);
            outgrno = (long)*inputval;
        }
    }
    else if (mxIsEmpty(prhs[0])) {
        mexErrMsgTxt("numDouble = NULL\n"); 
    }
    else
        mexErrMsgTxt("ERROR in <input_double> processing code.\n");



  openfile(&infile,INFILE,"input file", "r","Neighbor",infilename);
  openfile(&outfile,OUTFILE,"output file", "w","Neighbor",outfilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  mulsets = false;
  datasets = 1;
  doinit();
  





  if (trout){
    openfile(&outtree,OUTTREE,"output tree file", "w","Neighbor",outtreename);
    /* The next line is added to make a 'real' rooted tree -- James J. Cai 6/6/2006 */  
	putc('(', outtree);
  }

  ith = 1;
  while (ith <= datasets) {
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n",ith);
      if (progress)
        mexPrintf("Data set # %ld:\n",ith);
    }
    inputoptions();
    maketree();
    if (eoln(infile) && (ith < datasets)) 
      scan_eoln(infile);
    ith++;
  }
  FClose(infile);
  FClose(outfile);
  FClose(outtree);
  freerest();
  /* mexPrintf("Done.\n\n"); */

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
  outputval = mxGetPr(plhs[0]);
  /* memcpy(output, 1.0, sizeof(double)); */
  outputval[0] = 0;
  return;
}