libsequence  1.9.5
CoalescentMutation.cc
1 /*
2 
3  Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
4 
5  Remove the brackets to email me.
6 
7  This file is part of libsequence.
8 
9  libsequence is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  libsequence is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  long with libsequence. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #include <Sequence/Coalescent/Mutation.hpp>
25 
26 namespace Sequence
27 {
28  namespace coalsim {
29  void output_gametes(FILE * fp,
30  const unsigned & segsites,
31  const unsigned & nsam,
32  const gamete_storage_type & gametes)
43  {
44  fprintf(fp,"//\n");
45  if ( segsites > 0 )
46  {
47  fprintf(fp,"segsites: %u\npositions: ",segsites);
48  for(unsigned i=0;i<segsites;++i)
49  {
50  fprintf(fp,"%f ",gametes.first[i]);
51  }
52  fprintf(fp,"\n");
53  for(unsigned i=0;i<nsam;++i)
54  {
55  for(unsigned j=0;j<segsites;++j)
56  {
57  fprintf(fp,"%c",gametes.second[i][j]);
58  }
59  fprintf(fp,"\n");
60  }
61  }
62  else
63  {
64  fprintf(fp,"segsites: 0\n");
65  }
66  }
67  }
68 }
The namespace in which this library resides.
std::pair< std::vector< double >, std::vector< std::string > > gamete_storage_type
an object to store simulated gametes An object of this type will tend to exist in the calling environ...
Definition: Mutation.hpp:42
void output_gametes(FILE *fp, const unsigned &segsites, const unsigned &nsam, const gamete_storage_type &gametes)
Write an object of type gamete_storage type to a C-style file stream This function is used when you n...