libStatGen Software  1
GenericSamInterface.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 __GENERIC_SAM_INTERFACE_H__
19 #define __GENERIC_SAM_INTERFACE_H__
20 
21 #include "SamStatus.h"
22 #include "InputFile.h"
23 #include "SamFileHeader.h"
24 #include "SamRecord.h"
25 
27 {
28 public:
30  virtual ~GenericSamInterface();
31 
32  // Pure virtual method that reads the header section from the specified file
33  // and stores it in the passed in header, returns false and sets the status
34  // on failure.
35  // Will be implemented specifically for sam/bam files.
36  virtual bool readHeader(IFILE filePtr, SamFileHeader& header,
37  SamStatus& status) = 0;
38 
39  // Pure virtual method that writes the specified header into the specified
40  // file, returns false and sets the status on failure.
41  // Will be implemented specifically for sam/bam files.
42  virtual bool writeHeader(IFILE filePtr, SamFileHeader& header,
43  SamStatus& status) = 0;
44 
45  // Pure virtual method that reads the next record from the specified file
46  // and stores it in the passed in record.
47  // Will be implemented specifically for sam/bam files.
48  // TODO On error, a more detailed message is appended to statusMsg.
49  virtual void readRecord(IFILE filePtr, SamFileHeader& header,
50  SamRecord& record,
51  SamStatus& samStatus) = 0;
52 
53  // Pure virtual method that writes the specified record into the specified
54  // file.
55  // Will be implemented specifically for sam/bam files.
56  virtual SamStatus::Status writeRecord(IFILE filePtr, SamFileHeader& header,
57  SamRecord& record,
58  SamRecord::SequenceTranslation translation) = 0;
59 
60 };
61 
62 #endif
SamRecord::SequenceTranslation
SequenceTranslation
Enum containing the settings on how to translate the sequence if a reference is available.
Definition: SamRecord.h:57
StatGenStatus
This class is used to track the status results of some methods in the BAM classes.
Definition: StatGenStatus.h:27
StatGenStatus::Status
Status
Return value enum for StatGenFile methods.
Definition: StatGenStatus.h:32
InputFile.h
SamFileHeader
This class allows a user to get/set the fields in a SAM/BAM Header.
Definition: SamFileHeader.h:35
SamRecord
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
GenericSamInterface
Definition: GenericSamInterface.h:27
InputFile
Class for easily reading/writing files without having to worry about file type (uncompressed,...
Definition: InputFile.h:37