libStatGen Software  1
ModifyVar.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 void modifyFirstBase();
19 void modifyFirstBaseLong();
20 void testModifyVar();
21 
22 class modifyVar
23 {
24 public:
25  void testModifyVar(const char* filename, bool valBufFirst);
26 
27 private:
28  void testModifyReadNameOnlySameLength();
29  void testModifyCigarOnlySameLength();
30  void testModifySequenceOnlySameLength();
31  void testModifyQualityOnlySameLength();
32  void testRemoveQuality();
33  void testShortenQuality();
34  void testLengthenQuality();
35 
36  void testShortenReadName();
37  void testShortenCigar();
38  void testShortenSequence();
39 
40  void testLengthenReadName();
41  void testLengthenCigar();
42  void testLengthenSequence();
43 
44  void testRemoveCigar();
45  void testRemoveSequence();
46 
47  void testLengthenSequenceAndQuality();
48 
49  void validate();
50 
51  void validateReadName(const bamRecordStruct* recordBuffer);
52  void validateCigar(const bamRecordStruct* recordBuffer);
53  void validateSequence(const bamRecordStruct* recordBuffer);
54  void validateQuality(const bamRecordStruct* recordBuffer);
55  void validateTags(const bamRecordStruct* recordBuffer);
56 
57  void validateReadNameString();
58  void validateCigarString();
59  void validateSequenceString();
60  void validateQualityString();
61  void validateTagsString();
62 
63  // Open and read the first record.
64  void openAndRead1Rec();
65  void resetExpected();
66 
67  // Variables.
68  const char* myFilename;
69  bool myValBufFirst;
70 
71  // Rather than passing around all these variables, just store them in the class.
72  SamFile samIn;
73  SamFileHeader samHeader;
74  SamRecord samRecord;
75  const bamRecordStruct* recordBuffer;
76 
77  // Expected values.
78  int expectedCigarBufLen;
79  unsigned int expectedCigarBuffer[100];
80  unsigned char expectedSequenceBuffer[100];
81  int expectedTagsLen;
82  unsigned char expectedTagsBuffer[100];
83 
84  // Expected values for the strings.
85  std::string expectedReadNameString;
86  std::string expectedCigarString;
87  std::string expectedSequenceString;
88  std::string expectedQualityString;
89 };
90 
This class allows a user to get/set the fields in a SAM/BAM Header.
Definition: SamFileHeader.h:35
Allows the user to easily read/write a SAM/BAM file.
Definition: SamFile.h:36
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
Structure of a BAM record.
Definition: SamRecord.h:34