Debian Codegraph @

src/individu.h

raw
1 /***************************************************************************
2 individu.h - description
3 -------------------
4 begin : Thu Sep 14 2000
5 copyright : (C) 2000 by Olivier Langella
6 email : [email protected]
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 // individu
19 #ifndef INDIVIDU_H
20 #define INDIVIDU_H
21
22 #include "allele.h"
23
24 using namespace biolib::vecteurs;
25
26 class Individu {
27 public :
28 //
29 Individu (Population *);
30 Individu (Population * Ppop, const string& nom);
31 Individu (Population *, const ConstGnt &, int);
32
33 Individu (const Individu &, Population *);
34
35 // Individu (int nball=0);
36 ~Individu();
37
38 const Individu& operator= (const Individu &);
39 bool operator== (const Individu &) const;
40 bool r_estnul () const;
41 bool r_esthetero (unsigned long locus) const;
42 inline unsigned long r_nbcopall(Allele * Pall) const {return(_tabPall.getNbOccurence(Pall));};
43 unsigned long r_nballnonnuls(unsigned long locus, unsigned int nploidie) const;
44
45 inline unsigned long get_nballnuls () const;
46 unsigned long get_nballnuls (unsigned long) const;
47 void set_Pallele (Allele * Pall, unsigned int pos);
48
49 inline const string& get_nom() const {return(_nom);};
50 unsigned int get_nploidie() const {return(_nploidie);};
51 const Vecteur<Allele*>& get_tabPall() const {return(_tabPall);};
52 const string& get_nom_all(unsigned long numlocus, unsigned long numall) const;
53
54 void resize_alleles();
55
56 void affiche (ostream&, int) const;
57
58 friend class Population;
59 friend class StrucPop;
60 friend class DistancesGnt;
61 friend class Allele;
62 friend class Jeupop;
63
64 void ifFusionnerIndividu(const Individu& individu);
65 void ifPlacerAllele(Locus* Ploc, long position, const Allele * Pall);
66
67 void oPopulationsXML(unsigned int id, ostream & sortie, ostream & infos) const;
68
69 private :
70 void creation (Population * Ppop);
71 /** Suppresssion d'un locus */
72 void supprLocus(unsigned int);
73
74 string _nom;
75 // char _nom[20];
76 Population * _Ppop;
77 // unsigned long _nball; //nb allèles= nb de loci* n ploidie
78 unsigned int _nploidie;
79 Vecteur<Allele*> _tabPall;
80
81 public:
82 struct Anomalie{
83 // 1-> copie impossible: pas le meme nombre d'alleles
84 // 11-> numero de locus inexistant
85 // 12-> numéro d'allele inexistant
86 // 13-> un allele nul fausse la determination de l'heterozygotie de l'individu pour un locus
87 int le_pb;
88 Anomalie (int i):le_pb(i){};
89 };
90
91 };
92
93
94 inline unsigned long Individu::get_nballnuls () const {
95 //retourne le nombre d'alleles nuls de l'individu
96 unsigned long taille (_tabPall.size());
97 unsigned long i;
98 unsigned long resultat(0);
99
100 for (i = 0; i < taille; i++) {
101 if (_tabPall[i]->_miss) resultat++;
102 }
103 return(resultat);
104 }
105
106 #endif
107