bpp-seq3  3.0.0
StringSequenceTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_STRINGSEQUENCETOOLS_H
6 #define BPP_SEQ_STRINGSEQUENCETOOLS_H
7 
8 #include <Bpp/Exceptions.h>
9 
10 #include "Alphabet/Alphabet.h"
12 #include "SequenceExceptions.h"
13 
14 // From the STL:
15 #include <string>
16 #include <vector>
17 
18 namespace bpp
19 {
32 {
33 public:
36 
37 public:
47  static std::string subseq(const std::string& sequence, size_t begin, size_t end);
48 
58  static std::string setToSizeR(const std::string& sequence, size_t size);
59 
69  static std::string setToSizeL(const std::string& sequence, size_t size);
70 
78  static std::string deleteChar(const std::string& sequence, char chars);
79 
87  static std::string deleteChar(const std::string& sequence, std::string chars);
88 
95  static std::string* reverse(const std::string& sequence);
96 
108  static std::string* complement(const std::string& sequence);
109 
125  static double getGCcontent(const std::string& sequence, size_t pos, size_t window);
126 
141  static std::vector<int> codeSequence(const std::string& sequence, std::shared_ptr<const Alphabet>& alphabet);
142 
151  static std::string decodeSequence(const std::vector<int>& sequence, std::shared_ptr<const Alphabet>& alphabet);
152 
162  static std::shared_ptr<const Alphabet> getAlphabetFromSequence(const std::string& sequence);
163 };
164 } // end of namespace bpp.
165 #endif // BPP_SEQ_STRINGSEQUENCETOOLS_H
Utilitary methods working on raw string objects.
static double getGCcontent(const std::string &sequence, size_t pos, size_t window)
Calculate the local GC content of a sequence.
static std::shared_ptr< const Alphabet > getAlphabetFromSequence(const std::string &sequence)
Parse a sequence and try to guess the correct alphabet to use.
static std::string deleteChar(const std::string &sequence, char chars)
Delete all occurrence of a character in the sequence.
static std::string * complement(const std::string &sequence)
Get the complement of a sequence.
static std::string * reverse(const std::string &sequence)
Reverse the sequence.
static std::string subseq(const std::string &sequence, size_t begin, size_t end)
Get a subsequence.
static std::string setToSizeR(const std::string &sequence, size_t size)
Set up the size of a sequence from the right side.
static std::string setToSizeL(const std::string &sequence, size_t size)
Set up the size of a sequence from the left side.
static std::string decodeSequence(const std::vector< int > &sequence, std::shared_ptr< const Alphabet > &alphabet)
Convert a sequence to its string representation.
static std::vector< int > codeSequence(const std::string &sequence, std::shared_ptr< const Alphabet > &alphabet)
Convert a string sequence to a vector of int.
This alphabet is used to deal NumericAlphabet.