00001 00002 // 00003 // This file is part of the MADELINE 2 program 00004 // written by Edward H. Trager and Ritu Khanna 00005 // Copyright (c) 2005 by the 00006 // Regents of the University of Michigan. 00007 // All Rights Reserved. 00008 // 00009 // The latest version of this program is available from: 00010 // 00011 // http://eyegene.ophthy.med.umich.edu/madeline/ 00012 // 00013 // Released under the GNU General Public License. 00014 // A copy of the GPL is included in the distribution 00015 // package of this software, or see: 00016 // 00017 // http://www.gnu.org/copyleft/ 00018 // 00019 // ... for licensing details. 00020 // 00022 00023 // 00024 // 2005.08.17.ET.RK 00025 // 00026 00027 // 00028 // Haplotype.h 00029 // 00030 00031 #ifndef HAPLOTYPE_INCLUDED 00032 #define HAPLOTYPE_INCLUDED 00033 00034 #include <string> 00035 #include <iostream> 00036 #include "Data.h" 00037 #include "Number.h" 00038 00039 class Haplotype : public Data{ 00040 public: 00041 00042 // RECOMBINATION INFORMATION enumeration: 00043 enum RECOMBINATION_INFO{ MISSING_INFO='.',NO_INFORMATION=':',NO_RECOMBINATION='|',MATERNAL_RECOMBINATION='/',PATERNAL_RECOMBINATION='\\',BOTH_RECOMBINE='+' }; 00044 00045 private: 00046 static std::set<std::string> _haplotypeMissingValue; 00047 bool _isMissing; 00048 std::string _haplotype; 00049 00050 RECOMBINATION_INFO _recombination; 00051 00052 unsigned char _getRecombinationInfoSortOrder(void) const; 00053 public: 00054 00055 // 00056 // Static methods: 00057 // 00058 static void addHaplotypeMissingValue(std::string value){ _haplotypeMissingValue.insert(value); } 00059 static bool isMissingValue(std::string value); 00060 00061 // Constructors: 00062 Haplotype(){ setMissing(); } 00063 Haplotype(const char *h){ set(h); } 00064 Haplotype(const std::string& h){ set(h.c_str()); } 00065 00066 // Methods required by Data virtual base class: 00067 bool isMissing( void ) const { return _isMissing; } 00068 void setMissing( void ); 00069 void set( const char *haplotype ); 00070 void set( const std::string &haplotype); 00071 const std::string get( void ) const; 00072 00073 // 00074 // Operators: 00075 bool operator<( const Data& b) const; 00076 bool operator==( const Data& b) const; 00077 const DATATYPE getDataType( void ) const { return HAPLOTYPE; } 00078 virtual Haplotype* clone() const; 00079 00080 // Additional methods: 00081 const std::string getAlleleFromMom( void ) const; 00082 const std::string getAlleleFromDad( void ) const; 00083 Haplotype::RECOMBINATION_INFO getRecombinationInfo( void ) const; 00084 00085 }; 00086 00087 std::ostream &operator<<(std::ostream &s,const Haplotype &g); 00088 00089 #endif