libStatGen Software
1
|
00001 /* 00002 * Copyright (C) 2010 Regents of the University of Michigan 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef __PEDDESCRIBE_H__ 00019 #define __PEDDESCRIBE_H__ 00020 00021 #include "PedigreeGlobals.h" 00022 #include "PedigreePerson.h" 00023 #include "StringArray.h" 00024 #include "IntArray.h" 00025 00026 #include <stdio.h> 00027 00028 // Possible pedigree columns 00029 #define pcSkip 0 00030 #define pcMarker 1 00031 #define pcTrait 2 00032 #define pcAffection 3 00033 #define pcCovariate 4 00034 #define pcString 5 00035 #define pcZygosity 6 00036 #define pcEnd 7 00037 00038 // Undocumented pedigree column types -- not recommended 00039 #define pcUndocumentedTraitCovariate 1001 00040 00041 class PedigreeDescription : public PedigreeGlobals 00042 { 00043 public: 00044 int columnCount; 00045 IntArray columns, columnHash; 00046 00047 PedigreeDescription(); 00048 ~PedigreeDescription(); 00049 00050 void Load(IFILE & Input, bool warnIfLinkage = false); 00051 void Load(const char * filename, bool warnIfLinkage = false); 00052 00053 void LoadLinkageDataFile(IFILE & input); 00054 void LoadLinkageDataFile(const char * filename); 00055 00056 void LoadMendelDataFile(IFILE & input); 00057 void LoadMendelDataFile(const char * filename); 00058 00059 void LoadMap(IFILE & Input); 00060 void LoadMap(const char * filename); 00061 00062 PedigreeDescription & operator = (PedigreeDescription & rhs); 00063 00064 int CountTextColumns(); 00065 00066 // returns a string summarizing column contents 00067 const char * ColumnSummary(String & string); 00068 00069 // Flag specifying Mendel format 00070 bool mendelFormat; 00071 00072 String filename; 00073 00074 void AddMarkerColumn(const char * markerName); 00075 void AddTraitColumn(const char * traitName); 00076 void AddAffectionColumn(const char * affectionName); 00077 void AddCovariateColumn(const char * covariateName); 00078 void AddStringColumn(const char * stringName); 00079 void AddZygosityColumn(); 00080 void AddSkippedColumn(); 00081 00082 private: 00083 int ReadLineHelper(IFILE & input, String & buffer, StringArray & tokens); 00084 00085 int CountColumns(int type); 00086 void UpdateSummary(String & string, int type, const char * label); 00087 }; 00088 00089 #endif 00090