ARB
sim.c
Go to the documentation of this file.
1 #include "rns.h"
2 #include <time.h>
3 #include <stdlib.h>
4 
5 int ARB_main(int argc, char *argv[]) {
6  RNS origin;
7 
8  if (argc!=4) error("Usage: arb_treegen <cfg> <tree> <seq>\n"
9  "An evolution simulator - (C) 1995 by Ralf Westram\n"
10  "\n"
11  "Environment specification is read from <cfg> (will be generated if missing)\n"
12  "\n"
13  "<tree> file were the simulated phylogeny is saved to (as tree)\n"
14  "<seq> file were the simulated species are saved to (as sequences)\n"
15  );
16 
17  srand((unsigned)time(NULL));
19 
20  readSimCfg(argv[1]);
21  origin = createOriginRNS();
22 
23  topo = fopen(argv[2], "w"); if (!topo) { perror(argv[2]); exit(1); }
24  seq = fopen(argv[3], "w"); if (!seq) { perror(argv[3]); exit(1); }
25 
26  splitRNS(-1, origin, 0.0, timeSteps, 0);
27  dumpDepths();
28 
29  fclose(seq);
30  fclose(topo);
31 
32  free(origin);
33  return 0;
34 }
35 
36 
37 
void readSimCfg(cstr fname)
Definition: simcfg.c:60
int timeSteps
Definition: rns.c:19
FILE * seq
Definition: rns.c:46
Definition: rns.h:50
RNS createOriginRNS()
Definition: rns.c:157
void dumpDepths()
Definition: rns.c:55
static void error(const char *msg)
Definition: mkptypes.cxx:96
FILE * topo
Definition: rns.c:46
void initBaseLookups()
Definition: base.c:20
void splitRNS(int no_of_father, RNS origin, double age, int steps, int depth)
Definition: rns.c:493
int ARB_main(int argc, char *argv[])
Definition: sim.c:5