/usr/include/pbbam/BamRecordBuilder.h is in libpbbam-dev 0.7.4+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | // Copyright (c) 2014-2015, Pacific Biosciences of California, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted (subject to the limitations in the
// disclaimer below) provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
//
// * Neither the name of Pacific Biosciences nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
// GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC
// BIOSCIENCES AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
//
// File Description
/// \file BamRecordBuilder.h
/// \brief Defines the BamRecordBuilder class.
//
// Author: Derek Barnett
#ifndef BAMRECORDBUILDER_H
#define BAMRECORDBUILDER_H
#include "pbbam/BamRecord.h"
#include "pbbam/BamHeader.h"
#include "pbbam/Config.h"
#include <string>
namespace PacBio {
namespace BAM {
/// \brief The BamRecordBuilder class provides a helper utility for building
/// BamRecords.
///
/// This class provides a mechanism for building up %BAM data and
/// lazy-encoding/constructing the actual BamRecord. Currently, the methods here
/// really only support filling in the low-level SAM/BAM-style fields, not so
/// much the PacBio-specific fields.
///
class PBBAM_EXPORT BamRecordBuilder
{
public:
/// \name Constructors & Related Methods
/// \{
/// \brief Creates an empty %BAM record builder.
BamRecordBuilder(void);
/// \brief Creates an empty %BAM record builder, with header info to apply
/// to built records.
///
/// \param[in] header BamHeader object
///
explicit BamRecordBuilder(const BamHeader& header);
/// \brief Creates record builder with inital record data.
///
/// \param[in] prototype data from this record will be used to seed the
/// builder
///
BamRecordBuilder(const BamRecord& prototype);
BamRecordBuilder(const BamRecordBuilder& other);
BamRecordBuilder(BamRecordBuilder&& other);
BamRecordBuilder& operator=(const BamRecordBuilder& other);
BamRecordBuilder& operator=(BamRecordBuilder&& other);
~BamRecordBuilder(void);
/// \}
public:
/// \name Record-Building
/// \{
/// \brief Builds a BamRecord from current builder attributes.
///
/// \returns newly-built BamRecord object
///
BamRecord Build(void) const;
/// \brief Replaces an existing BamRecord's data with current builder
/// attributes.
///
/// \param[out] record resulting record
/// \returns true if successful
///
bool BuildInPlace(BamRecord& record) const;
/// \brief Resets builder attributes to default values.
///
void Reset(void);
/// \brief Resets builder attributes with \p prototype's data.
///
/// \param[in] prototype
///
void Reset(const BamRecord& prototype);
/// \brief Resets builder attributes with \p prototype's data.
///
/// \param[in] prototype
///
void Reset(BamRecord&& prototype);
/// \}
public:
/// \name Core Attribute Setup
/// \{
/// \brief Sets the record's (BAI) index bin ID.
///
/// \param[in] bin BAI index bin ID.
/// \returns reference to this builder
///
BamRecordBuilder& Bin(const uint32_t bin);
/// \brief Sets this record's alignment flag, using a raw integer.
///
/// \param[in] flag raw alignment flag
/// \returns reference to this record
///
BamRecordBuilder& Flag(const uint32_t flag);
/// \brief Sets this record's insert size.
///
/// \param[in] iSize insert size
/// \returns reference to this record
///
BamRecordBuilder& InsertSize(const int32_t iSize);
/// \brief Sets this record's map quality.
///
/// \param[in] mapQual mapping quality - value of 255 indicates "unknown"
/// \returns reference to this record
///
BamRecordBuilder& MapQuality(const uint8_t mapQual);
/// \brief Sets this record's mate's mapped position.
///
/// \param[in] pos mapped position. A value of -1 indicates unmapped.
/// \returns reference to this record
///
BamRecordBuilder& MatePosition(const int32_t pos);
/// \brief Sets this record's mate's mapped reference ID
///
/// \param[in] id reference ID. A value of -1 indicates unmapped.
/// \returns reference to this record
///
BamRecordBuilder& MateReferenceId(const int32_t id);
/// \brief Sets this record's mapped position.
///
/// \param[in] pos mapped position. A value of -1 indicates unmapped.
/// \returns reference to this record
///
BamRecordBuilder& Position(const int32_t pos);
/// \brief Sets this record's mapped reference ID
///
/// \param[in] id reference ID. A value of -1 indicates unmapped.
/// \returns reference to this record
///
BamRecordBuilder& ReferenceId(const int32_t id);
/// \}
public:
/// \name Alignment Flag Setup
/// \{
/// \brief Sets whether this record is a PCR/optical duplicate
BamRecordBuilder& SetDuplicate(bool ok);
/// \brief Sets whether this record failed quality controls
BamRecordBuilder& SetFailedQC(bool ok);
/// \brief Sets whether this record is the first mate of a pair.
BamRecordBuilder& SetFirstMate(bool ok);
/// \brief Sets whether this record was aligned.
BamRecordBuilder& SetMapped(bool ok);
/// \brief Sets whether this record's mate was aligned.
BamRecordBuilder& SetMateMapped(bool ok);
/// \brief Sets whether this record's mate mapped to reverse strand.
BamRecordBuilder& SetMateReverseStrand(bool ok);
/// \brief Sets whether this record came from paired-end sequencing.
BamRecordBuilder& SetPaired(bool ok);
/// \brief Sets whether this record is a read's primary alignment.
BamRecordBuilder& SetPrimaryAlignment(bool ok);
/// \brief Sets whether this record & its mate were properly mapped, per the
/// aligner.
///
BamRecordBuilder& SetProperPair(bool ok);
/// \brief Sets whether this record mapped to reverse strand.
BamRecordBuilder& SetReverseStrand(bool ok);
/// \brief Sets whether this record is the second mate of a pair.
BamRecordBuilder& SetSecondMate(bool ok);
/// \brief Sets whether this record is a supplementary alignment.
BamRecordBuilder& SetSupplementaryAlignment(bool ok);
/// \}
public:
/// \name Variable-Length Data Setup
/// \{
/// \brief Sets the record's CIGAR data.
///
/// \returns reference to this builder
///
BamRecordBuilder& Cigar(const PacBio::BAM::Cigar& cigar);
/// \brief Sets the record's CIGAR data.
///
/// \returns reference to this builder
///
BamRecordBuilder& Cigar(PacBio::BAM::Cigar&& cigar);
/// \brief Sets the record's name.
///
/// \returns reference to this builder
///
BamRecordBuilder& Name(const std::string& name);
/// \brief Sets the record's name.
///
/// \returns reference to this builder
///
BamRecordBuilder& Name(std::string&& name);
/// \brief Sets the record's qualities.
///
/// \returns reference to this builder
///
BamRecordBuilder& Qualities(const std::string& qualities);
/// \brief Sets the record's qualities.
///
/// \returns reference to this builder
///
BamRecordBuilder& Qualities(std::string&& qualities);
/// \brief Sets the record's sequence.
///
/// \returns reference to this builder
///
BamRecordBuilder& Sequence(const std::string& sequence);
/// \brief Sets the record's sequence.
///
/// \returns reference to this builder
///
BamRecordBuilder& Sequence(std::string&& sequence);
/// \brief Sets the record's tags.
///
/// \returns reference to this builder
///
BamRecordBuilder& Tags(const TagCollection& tags);
/// \brief Sets the record's tags.
///
/// \returns reference to this builder
///
BamRecordBuilder& Tags(TagCollection&& tags);
/// \}
private:
BamHeader header_;
bam1_core_t core_;
std::string name_;
std::string sequence_;
std::string qualities_;
PacBio::BAM::Cigar cigar_;
TagCollection tags_;
};
} // namespace BAM
} // namespace PacBio
#include "pbbam/internal/BamRecordBuilder.inl"
#endif // BAMRECORDBUILDER_H
|