Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

chromosome.h

Go to the documentation of this file.
00001 //****************************************************
00002 //  April, 1993, University of Illinois
00003 // Copyright (C) 1993, 1994 Tianlin Wang
00004 /* Copyright (C) 1994-2003 Matvec Development Team. 
00005 
00006   This program is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015     
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019   MA 02111-1307, USA 
00020 */
00021 
00022 #ifndef MATVEC_CHROMOSOME_H
00023 #define MATVEC_CHROMOSOME_H
00024 
00025 #include <cassert>
00026 #include <cstdlib>
00027 #include <cstdio>
00028 
00029 namespace matvec {
00030 
00031 /////////////////////// Locus class /////////////////////////////////
00032 /*!
00033    \class Locus Chromosome.h
00034    \brief locus
00035 
00036    \sa Chromosome
00037 */
00038 class Locus {
00039    public:
00040       double    effect;
00041       int       allele;       // can be QTL allele or ML allele
00042 
00043       Locus(void){effect=0.0; allele=0;}
00044 
00045       const Locus& operator=(const Locus& A);
00046 };
00047 
00048 /////////////////////// Chromosome class /////////////////////////////////
00049 /*!
00050    \class Chromosome
00051    \brief A chromosome
00052 
00053    \sa Genome
00054 */
00055 class Chromosome {
00056    protected:
00057       unsigned  chrom_id, numloci;
00058       double    chrom_freq;
00059       void      copyfrom(const Chromosome& A);
00060 
00061    public:
00062       Locus   *locus;
00063 
00064       Chromosome(void){numloci=0; locus = 0;}
00065       Chromosome(const Chromosome& A){copyfrom(A);}
00066       ~Chromosome(void){ if(locus) {delete [] locus; locus = 0;}}
00067 
00068       const Chromosome& operator=(const Chromosome& A);
00069 
00070       void      id(const unsigned newid) {chrom_id = newid;}
00071       void      freq(const double new_f) {chrom_freq = new_f;}
00072       void      resize(const unsigned nl);
00073 
00074       double    freq(void) const {return chrom_freq;}
00075       unsigned  nloci(void) {return numloci;}
00076       unsigned  id(void) const {return chrom_id;}
00077 };
00078 
00079 extern Chromosome* new_Chromosome_vec(const unsigned n);
00080 }
00081 
00082 #endif

Generated on Thu Jun 16 17:13:38 2005 for Matvec by doxygen1.2.16