SamFlag.h

00001 /*
00002  *  Copyright (C) 2010  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_FLAG_H__
00019 #define __SAM_FLAG_H__
00020 
00021 #include <stdint.h>
00022 
00023 
00024 class SamFlag
00025 {
00026 public:
00027     /// Constants for parsing a flag.
00028     static const int16_t PAIRED              = 0x0001;
00029     static const int16_t PROPER_PAIR         = 0x0002;
00030     static const int16_t UNMAPPED            = 0x0004;
00031     static const int16_t MATE_UNMAPPED       = 0x0008;
00032     static const int16_t REVERSE             = 0x0010;
00033     static const int16_t MATE_REVERSED       = 0x0020;
00034     static const int16_t FIRST_READ          = 0x0040;
00035     static const int16_t SECOND_READ         = 0x0080;
00036     static const int16_t SECONDARY_ALIGNMENT = 0x0100;
00037     static const int16_t FAILED_QUALITY      = 0x0200;
00038     static const int16_t DUPLICATE           = 0x0400;
00039 
00040     static inline bool isMapped(uint16_t flag) {return(!(flag & UNMAPPED));}
00041     static inline bool isPaired(uint16_t flag) {return(flag & PAIRED);}
00042     static inline bool isReverse(uint16_t flag) {return(flag & REVERSE);}
00043     static inline bool isProperPair(uint16_t flag) {return(flag & PROPER_PAIR);}
00044     static inline bool isDuplicate(uint16_t flag) {return(flag & DUPLICATE);}
00045     static inline bool isQCFailure(uint16_t flag) {return(flag & FAILED_QUALITY);}
00046 
00047     static inline void setUnmapped(uint16_t& flag) { flag |= UNMAPPED;}
00048 
00049 private:
00050     SamFlag();
00051 };
00052 
00053 
00054 #endif
Generated on Wed Nov 17 15:38:27 2010 for StatGen Software by  doxygen 1.6.3