6331 Patch* current_patch;
6339 unsigned int BIT = _isAsymmetrical;
6340 unsigned int loc, rec;
6358 for(
int i = 0; i < patchNbr; i++)
6359 for(
unsigned int k = 0; k < nb_trait; k++) {
6364 REC<<i+1<<
" "<<k+1<<
" "<<LOCUS+1<<
" "<<snp_allele.
get( LOCUS, BIT );
6384 message(
"TTQFreqExtractor::compute allele frequencies\n");
6389 vector<double> snp_tab(seqLength, 0.0);
6392 for(
int i = 0; i < patchNbr; i++) {
6396 snp_tab.
assign(seqLength, 0.0);
6399 for(
unsigned int s = 0; s < 2; ++s) {
6401 for(
unsigned int j = 0, size = current_patch->
size(
sex_t(s),
ADLTx); j < size; ++j) {
6408 for(
unsigned int i = 0; i < seqLength; ++i) {
6415 double inv2N = 1.0 / double(2*current_patch->
size(
ADLTx));
6418 for(
unsigned int k = 0; k < nb_trait; k++) {
6440 std::ofstream FILE ;
6443 FILE.open(filename.c_str(), ios::out);
6444 std::ios_base::sync_with_stdio(
false);
6447 message(
"TTQFreqExtractor::FHwrite (%s)\n",filename.c_str());
6450 if(!FILE)
fatal(
"Trait quanti could not open output file: \"%s\"\n",filename.c_str());
6452 for(
unsigned int i = 0; i <
_records.size(); ++i)
6457 std::ios_base::sync_with_stdio(
true);
std::string & get_path()
Definition: filehandler.h:142
FileServices * get_service()
Returns pointer to the FileServices.
Definition: filehandler.h:138
std::string & get_extension()
Definition: filehandler.h:146
string & getReplicateFileName()
Accessor to the current replicate file name.
Definition: fileservices.cc:457
virtual Metapop * get_pop_ptr()
Accessor to the pointer to the main population.
Definition: fileservices.h:112
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:48
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:276
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:431
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:497
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:533
void assign(sex_t SEX, age_idx AGE, size_t n)
Assigns a new container of given size for the sex and age class passed, sets all values to NULL.
Definition: metapop.h:560
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:192
const TMatrix & get_diallele_values()
Definition: ttquanti.h:434
unsigned int get_locus_ID(unsigned int locus, unsigned int trait)
Definition: ttquanti.h:454
unsigned int get_allele_model()
Definition: ttquanti.h:433
unsigned int get_locus_seq_pos(unsigned int loc, unsigned int trait)
Definition: ttquanti.h:452
unsigned int get_num_locus()
Definition: ttquanti.h:423
unsigned int get_seq_length()
Definition: ttquanti.h:426
unsigned int get_num_traits()
Definition: ttquanti.h:422
TTQuanti.
Definition: ttquanti.h:60
virtual bool get_allele_bit(unsigned int position, unsigned int allele) const =0
int _FHLinkedTraitIndex
Definition: filehandler.h:223
TProtoQuanti * _FHLinkedTrait
Definition: filehandler.h:222
static string int2str(const int i)
Writes an integer value into a string.
Definition: tstring.h:94
static string dble2str(const double d)
Writes a floating-point value into a string.
Definition: tstring.h:114
void fatal(const char *str,...)
Definition: output.cc:99
void message(const char *message,...)
Definition: output.cc:39
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:35
@ ADLTx
Definition: types.h:41