libStatGen Software  1
SamRecordHelper.h
1 /*
2  * Copyright (C) 2012 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_RECORD_HELPER_H__
19 #define __SAM_RECORD_HELPER_H__
20 
21 #include "SamRecord.h"
22 
23 /// Class for extracting information from a SAM Flag.
25 {
26 public:
27 
28  /// Helper method that checks if the record's read sequence starting
29  /// at the specified 0-based reference position matches the passed in
30  /// sequence.
31  /// \return returns -1 if it does not match,
32  /// returns the cycle (read position) of pos0Based if it does match.
33  static int checkSequence(SamRecord& record, int32_t pos0Based,
34  const char* sequence);
35 
36  /// Helper to append the SAM string representation of all the tags to
37  /// the specified string. Does NOT add a preceding delimiter before the
38  /// first tag.
39  /// \param record record whose tags to append.
40  /// \param returnString string to append the tags to.
41  /// \param delim delimiter to use to separate different tags.
42  /// \return true on success, false on failure/partial generation.
43  static bool genSamTagsString(SamRecord& record, String& returnString,
44  char delim = '\t');
45 
46 
47  /// Helper to append the SAM string representation of the specified tag to
48  /// the specified string.
49  /// \param tag the tag name.
50  /// \param vtype the vtype.
51  /// \param value pointer to the value of the tag (will be cast
52  /// to int, double, char, or string based on vtype).
53  /// \param returnString string to append the tag to.
54  /// \return true on success, false on failure/partial generation.
55  static bool genSamTagString(const char* tag, char vtype,
56  void* value, String& returnString);
57 
58 private:
60 };
61 
62 
63 #endif
String
Definition: StringBasics.h:39
SamRecordHelper::checkSequence
static int checkSequence(SamRecord &record, int32_t pos0Based, const char *sequence)
Helper method that checks if the record's read sequence starting at the specified 0-based reference p...
Definition: SamRecordHelper.cpp:21
SamRecordHelper::genSamTagString
static bool genSamTagString(const char *tag, char vtype, void *value, String &returnString)
Helper to append the SAM string representation of the specified tag to the specified string.
Definition: SamRecordHelper.cpp:86
SamRecord
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
SamRecordHelper::genSamTagsString
static bool genSamTagsString(SamRecord &record, String &returnString, char delim='\t')
Helper to append the SAM string representation of all the tags to the specified string.
Definition: SamRecordHelper.cpp:56
SamRecordHelper
Class for extracting information from a SAM Flag.
Definition: SamRecordHelper.h:25