Loading...
Searching...
No Matches
SamSequence.h
Go to the documentation of this file.
// ***************************************************************************
// SamSequence.h (c) 2010 Derek Barnett
// Marth Lab, Department of Biology, Boston College
// ---------------------------------------------------------------------------
// Last modified: 10 October 2011 (DB)
// ---------------------------------------------------------------------------
// Provides direct read/write access to the SAM sequence data fields.
// ***************************************************************************
#ifndef SAM_SEQUENCE_H
#define SAM_SEQUENCE_H
#include <string>
#include <vector>
#include "api/BamAux.h"
#include "api/api_global.h"
namespace BamTools {
struct API_EXPORT SamSequence
{
// ctor & dtor
SamSequence();
SamSequence(const std::string& name, const int& length);
SamSequence(const std::string& name, const std::string& length);
// query/modify entire sequence
void Clear(); // clears all contents
// convenience query methods
bool HasAssemblyID() const; // returns true if sequence has an assembly ID
bool HasChecksum() const; // returns true if sequence has an MD5 checksum
bool HasLength() const; // returns true if sequence has a length
bool HasName() const; // returns true if sequence has a name
bool HasSpecies() const; // returns true if sequence has a species ID
bool HasURI() const; // returns true if sequence has a URI
// data members
std::string AssemblyID; // AS:<AssemblyID>
std::string Checksum; // M5:<Checksum>
std::string Length; // LN:<Length> *Required for valid SAM header*
std::string Name; // SN:<Name> *Required for valid SAM header*
std::string Species; // SP:<Species>
std::string URI; // UR:<URI>
std::vector<CustomHeaderTag> CustomTags; // optional custom tags
};
inline bool operator==(const SamSequence& lhs, const SamSequence& rhs)
{
if (lhs.Name != rhs.Name) {
return false;
}
if (lhs.Length != rhs.Length) {
return false;
}
if (lhs.HasChecksum() && rhs.HasChecksum()) {
return (lhs.Checksum == rhs.Checksum);
} else {
return true;
}
}
} // namespace BamTools
#endif // SAM_SEQUENCE_H
BamAux.h
api_global.h
BamTools
Contains all BamTools classes & methods.
Definition Sort.h:24
BamTools::operator==
bool operator==(const SamProgram &lhs, const SamProgram &rhs)
tests equality by comparing program IDs
Definition SamProgram.h:57
BamTools::SamSequence
Represents a SAM sequence entry.
Definition SamSequence.h:21
BamTools::SamSequence::SamSequence
SamSequence()
default constructor
Definition SamSequence.cpp:47
BamTools::SamSequence::Length
std::string Length
corresponds to @SQ LN:<Length>
Definition SamSequence.h:42
BamTools::SamSequence::AssemblyID
std::string AssemblyID
corresponds to @SQ AS:<AssemblyID>
Definition SamSequence.h:40
BamTools::SamSequence::Name
std::string Name
corresponds to @SQ SN:<Name>
Definition SamSequence.h:43
BamTools::SamSequence::HasAssemblyID
bool HasAssemblyID() const
Returns true if sequence contains @SQ AS:<AssemblyID>.
Definition SamSequence.cpp:91
BamTools::SamSequence::HasName
bool HasName() const
Returns true if sequence contains @SQ SN:<Name>.
Definition SamSequence.cpp:115
BamTools::SamSequence::HasSpecies
bool HasSpecies() const
Returns true if sequence contains @SQ SP:<Species>.
Definition SamSequence.cpp:123
BamTools::SamSequence::URI
std::string URI
corresponds to @SQ UR:<URI>
Definition SamSequence.h:45
BamTools::SamSequence::Checksum
std::string Checksum
corresponds to @SQ M5:<Checksum>
Definition SamSequence.h:41
BamTools::SamSequence::Clear
void Clear()
Clears all data fields.
Definition SamSequence.cpp:77
BamTools::SamSequence::Species
std::string Species
corresponds to @SQ SP:<Species>
Definition SamSequence.h:44
BamTools::SamSequence::CustomTags
std::vector< CustomHeaderTag > CustomTags
Definition SamSequence.h:46
BamTools::SamSequence::HasURI
bool HasURI() const
Returns true if sequence contains @SQ UR:<URI>.
Definition SamSequence.cpp:131
BamTools::SamSequence::HasLength
bool HasLength() const
Returns true if sequence contains @SQ LN:<Length>.
Definition SamSequence.cpp:107
BamTools::SamSequence::HasChecksum
bool HasChecksum() const
Returns true if sequence contains @SQ M5:<Checksum>.
Definition SamSequence.cpp:99