btllib: btllib Namespace Reference

btllib

Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
btllib Namespace Reference

## Classes
class | AAHash
class | BlindNtHash
class | BlindSeedNtHash
class | BloomFilter
class | CountingBloomFilter
class | Indexlr
class | KmerBloomFilter
class | KmerCountingBloomFilter
class | NtHash
class | ProcessPipeline
class | RandSeq
class | SeedAAHash
class | SeedBloomFilter
class | SeedNtHash
class | SeqReader
class | SeqWriter

## Typedefs
using | SpacedSeed = std::vector<unsigned>
using | CountingBloomFilter8 = CountingBloomFilter<uint8_t>
using | CountingBloomFilter16 = CountingBloomFilter<uint16_t>
using | CountingBloomFilter32 = CountingBloomFilter<uint32_t>
using | KmerCountingBloomFilter8 = KmerCountingBloomFilter<uint8_t>
using | KmerCountingBloomFilter16 = KmerCountingBloomFilter<uint16_t>
using | KmerCountingBloomFilter32 = KmerCountingBloomFilter<uint32_t>
using | PipeId = unsigned long
using | PipelineId = unsigned long

## Functions
std::vector< SpacedSeed > | aa_parse_seeds (const std::vector< std::string > &seeds)
std::vector< std::vector< unsigned > > | parse_seeds (const std::vector< std::string > &seed_strings)
void | reverse_complement (std::string &seq)
std::string | get_reverse_complement (const std::string &seq)
std::string | get_time ()
void | log_info (const std::string &msg)
void | log_warning (const std::string &msg)
void | log_error (const std::string &msg)
void | check_info (bool condition, const std::string &msg)
void | check_warning (bool condition, const std::string &msg)
void | check_error (bool condition, const std::string &msg)
std::string | get_strerror ()
void | check_stream (const std::ios &stream, const std::string &name)
void | check_file_accessibility (const std::string &filepath)
std::vector< std::string > | split (const std::string &s, const std::string &delim)
std::string | join (const std::vector< std::string > &s, const std::string &delim)
void | ltrim (std::string &s)
void | ltrim (btllib::CString &s)
void | rtrim (std::string &s)
void | rtrim (btllib::CString &s)
void | trim (std::string &s)
void | trim (btllib::CString &s)
bool | startswith (std::string s, std::string prefix)
bool | endswith (std::string s, std::string suffix)
std::string | get_basename (const std::string &path)
std::string | get_dirname (const std::string &path)
double | sum_phred (const std::string &qual, size_t start_pos=0, size_t len=0)
double | calc_phred_avg (const std::string &qual, size_t start_pos=0, size_t len=0)

## Variables
const char | COMPLEMENTS [256]
const char | AMINO_ACIDS [256]
const char | CAPITALS [256]
constexpr const char * | PRINT_COLOR_INFO = "\33[32m"
constexpr const char * | PRINT_COLOR_WARNING = "\33[33m"
constexpr const char * | PRINT_COLOR_ERROR = "\33[31m"
constexpr const char * | PRINT_COLOR_END = "\33[0m"

## Detailed Description

Functions for sequence manipulation.

Functions for logging and error checking.

Random utility functions.

## Function Documentation

## ◆ calc_phred_avg()

double btllib::calc_phred_avg | ( | const std::string & | qual,
|  | size_t | start_pos = 0,
|  | size_t | len = 0 )

Calculate the average phred score of a string, depending on the start position and length.

Parameters

  qual | The quality string to calculate the average from.
  start_pos | The start position of the substring. Defaults to 0.
  len | The length of the substring. Defaults to 0. If 0, the whole string is used.

Returns
  The average phred score of the substring.

## ◆ check_error()

void btllib::check_error | ( | bool | condition,
|  | const std::string & | msg )

Conditionally log error level events. The program exits if the condition is true.

Parameters

  condition | If this is true, the message is printed and the program exits.
  msg | Message to print.

## ◆ check_file_accessibility()

void btllib::check_file_accessibility | ( | const std::string & | filepath | ) |

Check whether the file at the given path is accessible (exists, permissions are good, etc.).

Parameters

  filepath | Path to the file to check.

## ◆ check_info()

void btllib::check_info | ( | bool | condition,
|  | const std::string & | msg )

Conditionally log info level events.

Parameters

  condition | If this is true, the message is printed.
  msg | Message to print.

## ◆ check_stream()

void btllib::check_stream | ( | const std::ios & | stream,
|  | const std::string & | name )

Check whether the stream is good. Program prints an error message and exits if not.

Parameters

  stream | Stream to check goodness of.
  name | Name of the stream, e.g. filepath or stdin

## ◆ check_warning()

void btllib::check_warning | ( | bool | condition,
|  | const std::string & | msg )

Conditionally log warning level events.

Parameters

  condition | If this is true, the message is printed.
  msg | Message to print.

## ◆ endswith()

bool btllib::endswith | ( | std::string | s,
|  | std::string | suffix )

Check whether the given string ends with a suffix.

Parameters

  s | String to check.
  suffix | Suffix to check for.

## ◆ get_basename()

std::string btllib::get_basename | ( | const std::string & | path | ) |

Equivalent to the GNU implementation of basename, but returns a string copy of the result.

Parameters

  path | The path to get basename from.

Returns
  The basename of the path.

## ◆ get_dirname()

std::string btllib::get_dirname | ( | const std::string & | path | ) |

Equivalent to the GNU implementation of dirname, but returns a string copy of the result.

Parameters

  path | The path to get dirname from.

Returns
  The dirname of the path.

## ◆ get_reverse_complement()

std::string btllib::get_reverse_complement | ( | const std::string & | seq | ) |

Obtain a reverse complement of the provided sequence. The argument sequence is left untouched.

Parameters

  seq | Sequence to reverse complement.

Returns
  Reverse complemented sequence.

## ◆ get_time()

std::string btllib::get_time | ( |  | ) |

Return current time as a string.

## ◆ join()

std::string btllib::join | ( | const std::vector< std::string > & | s,
|  | const std::string & | delim )

Join a vector of strings into a single string with a delimiter.

Parameters

  s | Vector of strings to join.
  delim | Delimiter to join the strings with.

Returns
  String with all the components joined.

## ◆ log_error()

void btllib::log_error | ( | const std::string & | msg | ) |

Log error level events.

Parameters

  msg | Message to print.

## ◆ log_info()

void btllib::log_info | ( | const std::string & | msg | ) |

Log info level events.

Parameters

  msg | Message to print.

## ◆ log_warning()

void btllib::log_warning | ( | const std::string & | msg | ) |

Log warning level events.

Parameters

  msg | Message to print.

## ◆ ltrim()

void btllib::ltrim | ( | std::string & | s | ) |

Trim whitespace on the left side of the given string.

Parameters

  s | String to trim, edited in-place.

## ◆ parse_seeds()

std::vector< std::vector< unsigned > > btllib::parse_seeds | ( | const std::vector< std::string > & | seed_strings | ) |
| inline

Parse each spaced seed pattern into lists of don't care positions. Legacy function used in btllib Bloom filters.

## ◆ reverse_complement()

void btllib::reverse_complement | ( | std::string & | seq | ) |

Reverse complement a sequence in-place.

Parameters

  seq | Sequence to reverse complement.

## ◆ rtrim()

void btllib::rtrim | ( | std::string & | s | ) |

Trim whitespace on the right side of the given string.

Parameters

  s | String to trim, edited in-place.

## ◆ split()

std::vector< std::string > btllib::split | ( | const std::string & | s,
|  | const std::string & | delim )

Split a string into component substrings with a delimiter.

Parameters

  s | String to split.
  delim | Delimiter to split with.

Returns
  Vector of substrings delimited by `delim`, excluding delimiters themselves.

## ◆ startswith()

bool btllib::startswith | ( | std::string | s,
|  | std::string | prefix )

Check whether the given string starts with a prefix.

Parameters

  s | String to check.
  prefix | Prefix to check for.

## ◆ sum_phred()

double btllib::sum_phred | ( | const std::string & | qual,
|  | size_t | start_pos = 0,
|  | size_t | len = 0 )

Calculate the sum of the phred scores of a string.

Parameters

  qual | The quality string to calculate the sum from.
  start_pos | The start position of the substring. Defaults to 0.
  len | The length of the substring. Defaults to 0. If 0, the whole string is used.

Returns
  The sum of the phred scores of the substring.

## ◆ trim()

void btllib::trim | ( | std::string & | s | ) |

Trim whitespace on the left and right side of the given string.

Parameters

  s | String to trim, edited in-place.