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{
25public:
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,
50
51 virtual bool isEOF(IFILE filePtr);
52
53private:
54 void ParseHeaderLine(StringIntHash & tags, StringArray & values);
55 String buffer;
56 StringArray tokens;
57
58 // Store the first record as it is read when trying to read the
59 // header so it can be returned when a record is read.
60 // Clear after it has been processed.
61 String myFirstRecord;
62};
63
64#endif
65
Class for easily reading/writing files without having to worry about file type (uncompressed,...
Definition: InputFile.h:37
This class allows a user to get/set the fields in a SAM/BAM Header.
Definition: SamFileHeader.h:35
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
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:27
Status
Return value enum for StatGenFile methods.
Definition: StatGenStatus.h:32