libStatGen Software  1
SamInterface.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 __SAM_INTERFACE_H__
19 #define __SAM_INTERFACE_H__
20 
21 #include "GenericSamInterface.h"
22 
24 {
25 public:
26  SamInterface();
27  ~SamInterface();
28 
29  // Reads the header section from the specified SAM file and stores it in
30  // the passed in header.
31  virtual bool readHeader(IFILE filePtr, SamFileHeader& header,
32  SamStatus& status);
33 
34  // Writes the specified header into the specified SAM file.
35  virtual bool writeHeader(IFILE filePtr, SamFileHeader& header,
36  SamStatus& status);
37 
38  // Reads the next record from the specified SAM file and stores it in
39  // the passed in record.
40  virtual void readRecord(IFILE filePtr,
41  SamFileHeader& header,
42  SamRecord& record,
43  SamStatus& samStatus);
44 
45  // Writes the specified record into the specified SAM file.
46  virtual SamStatus::Status writeRecord(IFILE filePtr,
47  SamFileHeader& header,
48  SamRecord& record,
49  SamRecord::SequenceTranslation translation);
50 
51 private:
52  void ParseHeaderLine(StringIntHash & tags, StringArray & values);
53  String buffer;
54  StringArray tokens;
55 
56  // Store the first record as it is read when trying to read the
57  // header so it can be returned when a record is read.
58  // Clear after it has been processed.
59  String myFirstRecord;
60 };
61 
62 #endif
63 
SequenceTranslation
Enum containing the settings on how to translate the sequence if a reference is available.
Definition: SamRecord.h:57
This class is used to track the status results of some methods in the BAM classes.
Definition: StatGenStatus.h:26
Class for easily reading/writing files without having to worry about file type (uncompressed, gzip, bgzf) when reading.
Definition: InputFile.h:36
This class allows a user to get/set the fields in a SAM/BAM Header.
Definition: SamFileHeader.h:34
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record...
Definition: SamRecord.h:51
Status
Return value enum for StatGenFile methods.
Definition: StatGenStatus.h:31