libStatGen Software
1
|
00001 /* 00002 * Copyright (C) 2011 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 __CIGAR_HELPER_H__ 00019 #define __CIGAR_HELPER_H__ 00020 00021 #include "SamRecord.h" 00022 00023 /// Class for helping to filter a SAM/BAM record. 00024 class CigarHelper 00025 { 00026 public: 00027 static const int32_t NO_CLIP = -1; 00028 00029 /// Soft clip the cigar from the beginning of the read at the specified 00030 /// reference position. If the clip position is deleted/skipped 00031 /// or is immediately followed by a deletion/skip/pad/insert, that entire 00032 /// CIGAR operation is also removed. 00033 /// Nothing is clipped if the reference position is before the read starts, 00034 /// everything is clipped if the reference position is after the read ends. 00035 /// \param record record to calculate the clip for. 00036 /// \param refPosition0Based 0-based reference position to end the clip at 00037 /// \param newCigar cigar object to set with the updated cigar. 00038 /// \param new0BasedPosition new 0-based reference position of the read. 00039 /// \param read position where the clip ends (last clipped position) or 00040 // NO_CLIP if nothing is clipped. 00041 static int32_t softClipBeginByRefPos(SamRecord& record, 00042 int32_t refPosition0Based, 00043 CigarRoller& newCigar, 00044 int32_t &new0BasedPosition); 00045 00046 /// Soft clip the cigar from the back of the read at the specified 00047 /// reference position. If the clip position is deleted/skipped 00048 /// or is immediately preceded by a deletion/skip/pad, that entire CIGAR 00049 /// operation is also removed. If the clip position is immediately 00050 /// preceded by an insertion, the insertion is left in the CIGAR. 00051 /// Nothing is clipped if the reference position is after the read ends, 00052 /// everything is clipped if the reference position is before the read 00053 /// starts (including insertions). 00054 /// \param record record to calculate the clip for. 00055 /// \param refPosition0Based 0-based reference position to start clip at 00056 /// \param newCigar cigar object to set with the updated cigar. 00057 /// \param read position where the clip starts or 00058 // NO_CLIP if nothing is clipped. 00059 static int32_t softClipEndByRefPos(SamRecord& record, 00060 int32_t refPosition0Based, 00061 CigarRoller& newCigar); 00062 }; 00063 00064 #endif 00065