Scaffolding  0.1
This program can assemble genome scaffolds using the pairing information in paired-end reads.
Macros | Functions
string_utils.hpp File Reference
#include <string>
#include "utils/exceptions.hpp"

Go to the source code of this file.

Macros

#define WHITESPACES   " \t"
 

Functions

void skip_to (std::string &s, const std::string &skip_to)
 remove all characters not in 'skip_to' from the beginning of s
 
void skip_all (std::string &s, const std::string &to_skip)
 remove all characters in 'to_skip' from the beginning of s
 
long read_single_number (std::string &s)
 consume an integer from the beginning of s and return it
 
std::string trim (const std::string &str, const std::string &to_remove=WHITESPACES)
 remove leading & trailing chars (whitespaces by default) from str
 
unsigned levenshtein_distance (const std::string &s1, const std::string &s2)
 return the levenstein distance between two strings More...
 
unsigned hamming_distance (const std::string &s1, const std::string &s2)
 returns the Hamming distance between the maximal prefixes of equal length
 
unsigned hamming_distance (const char *s1, const char *s2, unsigned length)
 returns the Hamming distance between the maximal prefixes of equal length (char* version) More...
 
std::string merge_strings_segfault (const std::string &seq1, const std::string &seq2, const unsigned overlap)
 merge two sequences seq1 and seq2 with overlap "overlap" according to their order More...
 
std::string merge_strings (const std::string &seq1, const std::string &seq2, const unsigned overlap)
 merge two sequences seq1 and seq2 with overlap "overlap" according to their order More...
 

Detailed Description

collection of utilities working with strings

Function Documentation

unsigned hamming_distance ( const char *  s1,
const char *  s2,
unsigned  length 
)

returns the Hamming distance between the maximal prefixes of equal length (char* version)

Note: no checks are performed, use at own risk

unsigned levenshtein_distance ( const std::string &  s1,
const std::string &  s2 
)

return the levenstein distance between two strings

used under CC license from https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance

std::string merge_strings ( const std::string &  seq1,
const std::string &  seq2,
const unsigned  overlap 
)

merge two sequences seq1 and seq2 with overlap "overlap" according to their order

For example: merge_strings("abcde", "1234", 3) = "ab1234"

std::string merge_strings_segfault ( const std::string &  seq1,
const std::string &  seq2,
const unsigned  overlap 
)

merge two sequences seq1 and seq2 with overlap "overlap" according to their order

This functions segfaults for reasons that are beyond me... For now, use the non-segfaulting "merge_strings()" below