libStatGen Software  1
CigarHelper.h
1 /*
2  * Copyright (C) 2011 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 __CIGAR_HELPER_H__
19 #define __CIGAR_HELPER_H__
20 
21 #include "SamRecord.h"
22 
23 /// Class for helping to filter a SAM/BAM record.
25 {
26 public:
27  static const int32_t NO_CLIP = -1;
28 
29  /// Soft clip the cigar from the beginning of the read at the specified
30  /// reference position. If the clip position is deleted/skipped
31  /// or is immediately followed by a deletion/skip/pad/insert, that entire
32  /// CIGAR operation is also removed.
33  /// Nothing is clipped if the reference position is before the read starts,
34  /// everything is clipped if the reference position is after the read ends.
35  /// \param record record to calculate the clip for.
36  /// \param refPosition0Based 0-based reference position to end the clip at
37  /// \param newCigar cigar object to set with the updated cigar.
38  /// \param new0BasedPosition new 0-based reference position of the read.
39  /// \param read position where the clip ends (last clipped position) or
40  // NO_CLIP if nothing is clipped.
41  static int32_t softClipBeginByRefPos(SamRecord& record,
42  int32_t refPosition0Based,
43  CigarRoller& newCigar,
44  int32_t &new0BasedPosition);
45 
46  /// Soft clip the cigar from the back of the read at the specified
47  /// reference position. If the clip position is deleted/skipped
48  /// or is immediately preceded by a deletion/skip/pad, that entire CIGAR
49  /// operation is also removed. If the clip position is immediately
50  /// preceded by an insertion, the insertion is left in the CIGAR.
51  /// Nothing is clipped if the reference position is after the read ends,
52  /// everything is clipped if the reference position is before the read
53  /// starts (including insertions).
54  /// \param record record to calculate the clip for.
55  /// \param refPosition0Based 0-based reference position to start clip at
56  /// \param newCigar cigar object to set with the updated cigar.
57  /// \param read position where the clip starts or
58  // NO_CLIP if nothing is clipped.
59  static int32_t softClipEndByRefPos(SamRecord& record,
60  int32_t refPosition0Based,
61  CigarRoller& newCigar);
62 };
63 
64 #endif
65 
CigarHelper::softClipBeginByRefPos
static int32_t softClipBeginByRefPos(SamRecord &record, int32_t refPosition0Based, CigarRoller &newCigar, int32_t &new0BasedPosition)
Soft clip the cigar from the beginning of the read at the specified reference position.
Definition: CigarHelper.cpp:23
CigarHelper::softClipEndByRefPos
static int32_t softClipEndByRefPos(SamRecord &record, int32_t refPosition0Based, CigarRoller &newCigar)
Soft clip the cigar from the back of the read at the specified reference position.
Definition: CigarHelper.cpp:184
CigarHelper
Class for helping to filter a SAM/BAM record.
Definition: CigarHelper.h:25
SamRecord
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
Definition: SamRecord.h:52
CigarRoller
The purpose of this class is to provide accessors for setting, updating, modifying the CIGAR object....
Definition: CigarRoller.h:67