libStatGen Software  1
SamRecordHelper.h
00001 /*
00002  *  Copyright (C) 2012  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef __SAM_RECORD_HELPER_H__
00019 #define __SAM_RECORD_HELPER_H__
00020 
00021 #include "SamRecord.h"
00022 
00023 /// Class for extracting information from a SAM Flag.
00024 class SamRecordHelper
00025 {
00026 public:
00027 
00028     /// Helper method that checks if the record's read sequence starting
00029     /// at the specified 0-based reference position matches the passed in
00030     /// sequence.
00031     /// \return returns -1 if it does not match,
00032     /// returns the cycle (read position) of pos0Based if it does match.
00033     static int checkSequence(SamRecord& record, int32_t pos0Based, 
00034                               const char* sequence);
00035     
00036     /// Helper to append the SAM string representation of all the tags to 
00037     /// the specified string.  Does NOT add a preceding delimiter before the
00038     /// first tag.
00039     /// \param record record whose tags to append.
00040     /// \param returnString string to append the tags to.
00041     /// \param delim delimiter to use to separate different tags.
00042     /// \return true on success, false on failure/partial generation.
00043     static bool genSamTagsString(SamRecord& record, String& returnString,
00044                                  char delim = '\t');
00045 
00046 
00047     /// Helper to append the SAM string representation of the specified tag to 
00048     /// the specified string.
00049     /// \param tag the tag name.
00050     /// \param vtype the vtype.
00051     /// \param value pointer to the value of the tag (will be cast
00052     /// to int, double, char, or string based on vtype).
00053     /// \param returnString string to append the tag to.
00054     /// \return true on success, false on failure/partial generation.
00055     static bool genSamTagString(const char* tag, char vtype, 
00056                                 void* value, String& returnString);
00057 
00058 private:
00059     SamRecordHelper();
00060 };
00061 
00062 
00063 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends