|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
42 #include <unordered_map>
45 #include <htslib/sam.h>
49 namespace population {
60 {
"properpair", 0x2 },
64 {
"mateunmapped", 0x8 },
67 {
"matereverse", 0x20 },
70 {
"secondary", 0x100 },
73 {
"duplicate", 0x400 },
74 {
"supplementary", 0x800 }
86 int result = bam_str2flag( value.c_str() );
110 for(
auto const& flag : flags ) {
117 int const tmp = bam_str2flag( cleaned_value.c_str() );
125 throw std::invalid_argument(
"Invalid sam flag name \"" + flag +
"\"" );
134 char* str = bam_flag2str( flags );
135 auto res = std::string( str );
145 static_cast<int>( 0x1 ) == BAM_FPAIRED,
146 "Definitions of BAM_FPAIRED in htslib and in genesis differ. "
147 "Please submit a bug report at https://github.com/lczech/genesis/issues"
150 static_cast<int>( 0x2 ) == BAM_FPROPER_PAIR,
151 "Definitions of BAM_FPROPER_PAIR in htslib and in genesis differ. "
152 "Please submit a bug report at https://github.com/lczech/genesis/issues"
155 static_cast<int>( 0x4 ) == BAM_FUNMAP,
156 "Definitions of BAM_FUNMAP in htslib and in genesis differ. "
157 "Please submit a bug report at https://github.com/lczech/genesis/issues"
160 static_cast<int>( 0x8 ) == BAM_FMUNMAP,
161 "Definitions of BAM_FMUNMAP in htslib and in genesis differ. "
162 "Please submit a bug report at https://github.com/lczech/genesis/issues"
165 static_cast<int>( 0x10 ) == BAM_FREVERSE,
166 "Definitions of BAM_FREVERSE in htslib and in genesis differ. "
167 "Please submit a bug report at https://github.com/lczech/genesis/issues"
170 static_cast<int>( 0x20 ) == BAM_FMREVERSE,
171 "Definitions of BAM_FMREVERSE in htslib and in genesis differ. "
172 "Please submit a bug report at https://github.com/lczech/genesis/issues"
175 static_cast<int>( 0x40 ) == BAM_FREAD1,
176 "Definitions of BAM_FREAD1 in htslib and in genesis differ. "
177 "Please submit a bug report at https://github.com/lczech/genesis/issues"
180 static_cast<int>( 0x80 ) == BAM_FREAD2,
181 "Definitions of BAM_FREAD2 in htslib and in genesis differ. "
182 "Please submit a bug report at https://github.com/lczech/genesis/issues"
185 static_cast<int>( 0x100 ) == BAM_FSECONDARY,
186 "Definitions of BAM_FSECONDARY in htslib and in genesis differ. "
187 "Please submit a bug report at https://github.com/lczech/genesis/issues"
190 static_cast<int>( 0x200 ) == BAM_FQCFAIL,
191 "Definitions of BAM_FQCFAIL in htslib and in genesis differ. "
192 "Please submit a bug report at https://github.com/lczech/genesis/issues"
195 static_cast<int>( 0x400 ) == BAM_FDUP,
196 "Definitions of BAM_FDUP in htslib and in genesis differ. "
197 "Please submit a bug report at https://github.com/lczech/genesis/issues"
200 static_cast<int>( 0x800 ) == BAM_FSUPPLEMENTARY,
201 "Definitions of BAM_FSUPPLEMENTARY in htslib and in genesis differ. "
202 "Please submit a bug report at https://github.com/lczech/genesis/issues"
269 #endif // htslib guard
Provides some valuable algorithms that are not part of the C++ 11 STL.
constexpr bool is_alnum(char c) noexcept
Return whether a char is a letter (a-z or A-Z) or a digit (0-9), ASCII-only.
std::vector< std::string > split(std::string const &str, char delimiter, const bool trim_empty)
Spilt a string into parts, given a delimiter char.
Provides some commonly used string utility functions.
void erase_if(Container &c, UnaryPredicate p)
Erases all elements from the container that satisfy a given predicate. An element is erased,...
static const std::unordered_map< std::string, int > sam_flag_name_to_int_
Map from sam flags to their numerical value, for different types of naming of the flags.
int string_to_sam_flag(std::string const &value)
Parse a string as a set of flags for sam/bam/cram reads.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::string sam_flag_to_string(int flags)
Turn a set of flags for sam/bam/cram reads into their textual representation.
std::string to_lower_ascii(std::string const &str)
Return an all-lowercase copy of the given string, ASCII-only.