libStatGen Software 1
PedigreeDescription.h
1/*
2 * Copyright (C) 2010 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __PEDDESCRIBE_H__
19#define __PEDDESCRIBE_H__
20
21#include "PedigreeGlobals.h"
22#include "PedigreePerson.h"
23#include "StringArray.h"
24#include "IntArray.h"
25
26#include <stdio.h>
27
28// Possible pedigree columns
29#define pcSkip 0
30#define pcMarker 1
31#define pcTrait 2
32#define pcAffection 3
33#define pcCovariate 4
34#define pcString 5
35#define pcZygosity 6
36#define pcEnd 7
37
38// Undocumented pedigree column types -- not recommended
39#define pcUndocumentedTraitCovariate 1001
40
42{
43public:
44 int columnCount;
45 IntArray columns, columnHash;
46
49
50 void Load(IFILE & Input, bool warnIfLinkage = false);
51 void Load(const char * filename, bool warnIfLinkage = false);
52
53 void LoadLinkageDataFile(IFILE & input);
54 void LoadLinkageDataFile(const char * filename);
55
56 void LoadMendelDataFile(IFILE & input);
57 void LoadMendelDataFile(const char * filename);
58
59 void LoadMap(IFILE & Input);
60 void LoadMap(const char * filename);
61
62 PedigreeDescription & operator = (PedigreeDescription & rhs);
63
64 int CountTextColumns();
65
66 // returns a string summarizing column contents
67 const char * ColumnSummary(String & string);
68
69 // Flag specifying Mendel format
70 bool mendelFormat;
71
72 String filename;
73
74 void AddMarkerColumn(const char * markerName);
75 void AddTraitColumn(const char * traitName);
76 void AddAffectionColumn(const char * affectionName);
77 void AddCovariateColumn(const char * covariateName);
78 void AddStringColumn(const char * stringName);
79 void AddZygosityColumn();
80 void AddSkippedColumn();
81
82private:
83 int ReadLineHelper(IFILE & input, String & buffer, StringArray & tokens);
84
85 int CountColumns(int type);
86 void UpdateSummary(String & string, int type, const char * label);
87};
88
89#endif
90
Class for easily reading/writing files without having to worry about file type (uncompressed,...
Definition: InputFile.h:37