libStatGen Software  1
WriteFiles.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 #ifndef __WRITE_FILES_H__
18 #define __WRITE_FILES_H__
19 
20 #include <stdio.h>
21 #include "GlfFile.h"
22 
23 
24 void testWrite();
25 void testHeaderWrite();
26 void testWriteCopiedHeader();
27 
28 class TestWrite
29 {
30 public:
31  void testWrite();
32 private:
33  void writeHeader(GlfFile& glfOut, int headerNum);
34  void writeRefSection1(GlfFile& glfOut);
35  void writeSec1Record1(GlfFile& glfOut);
36  void writeSec1Record2(GlfFile& glfOut);
37  void writeEndMarker(GlfFile& glfOut);
38  void writeRefSection2(GlfFile& glfOut);
39  void writeSec2Record1(GlfFile& glfOut);
40 
41  void readHeader(GlfFile& glfIn, int headerNum);
42  void readRefSection1(GlfFile& glfIn);
43  void readSec1Record1(GlfFile& glfIn);
44  void readSec1Record2(GlfFile& glfIn);
45  void readEndMarker(GlfFile& glfIn);
46  void readRefSection2(GlfFile& glfIn);
47  void readSec2Record1(GlfFile& glfIn);
48 
49  void checkEOF(GlfFile& glfIn);
50 
51  // 1st file header values:
52  static const std::string HEADER_TEXT1;
53 
54  // SEC1 values:
55  static const std::string SEC1_REFNAME;
56  static const uint32_t SEC1_REFLEN = 200;
57 
58  // SEC1REC1 values:
59  static const uint8_t SEC1REC1_RECTYPE = 1;
60  static const uint8_t SEC1REC1_REFBASE = 4;
61  static const uint32_t SEC1REC1_OFFSET = 99;
62  static const uint32_t SEC1REC1_MINLK = 55;
63  static const uint32_t SEC1REC1_READDEPTH = 31;
64  static const uint8_t SEC1REC1_RMSMAPQ = 25;
65 
66  // SEC1REC2 values:
67  static const uint8_t SEC1REC2_RECTYPE = 2;
68  static const uint8_t SEC1REC2_REFBASE = 1;
69  static const uint32_t SEC1REC2_OFFSET = 6;
70  static const uint32_t SEC1REC2_MINLK = 44;
71  static const uint32_t SEC1REC2_READDEPTH = 66;
72  static const uint8_t SEC1REC2_RMSMAPQ = 32;
73  static const uint8_t SEC1REC2_LKHOM1 = 98;
74  static const uint8_t SEC1REC2_LKHOM2 = 86;
75  static const uint8_t SEC1REC2_LKHET = 73;
76  static const int16_t SEC1REC2_INDELLEN1 = 2;
77  static const int16_t SEC1REC2_INDELLEN2 = -3;
78  static const std::string SEC1REC2_INDELSEQ1;
79  static const std::string SEC1REC2_INDELSEQ2;
80 
81  // SEC2 values
82  static const std::string SEC2_REFNAME;
83  static const uint32_t SEC2_REFLEN = 102;
84 
85  // SEC2REC1 values:
86  static const uint8_t SEC2REC1_RECTYPE = 1;
87  static const uint8_t SEC2REC1_REFBASE = 2;
88  static const uint32_t SEC2REC1_OFFSET = 50;
89  static const uint32_t SEC2REC1_MINLK = 55;
90  static const uint32_t SEC2REC1_READDEPTH = 31;
91  static const uint8_t SEC2REC1_RMSMAPQ = 25;
92 
93  // 2nd file header.
94  static const std::string HEADER_TEXT2;
95  // 3rd file header.
96  static const std::string HEADER_TEXT3;
97 };
98 #endif
TestWrite
Definition: WriteFiles.h:28
GlfFile
This class allows a user to easily read/write a GLF file.
Definition: GlfFile.h:28