File: mafft_alignment.h

package info (click to toggle)
prank 0.0.170427%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, trixie
  • size: 1,228 kB
  • sloc: cpp: 24,023; makefile: 515; sh: 12
file content (59 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef MAFFT_ALIGNMENT_H
#define MAFFT_ALIGNMENT_H

#include <fstream>
#include <string>
#include <vector>
#include <sys/stat.h>

extern std::string tempdir;


class Mafft_alignment
{

    std::string remove_last_whitespaces(const std::string & s)
    {
        // Copy sequence
        std::string st (s);

        while (st.size() > 0 && this->is_whitespace_character(st[st.size() - 1]))
        {
            st.erase(st.end() - 1);
        }

        // Send result
        return st;
    }

    std::string remove_whitespaces(const std::string & s)
    {
        std::string st="";

        for (unsigned int i = 0; i < s.size(); i++)
        {
            if (!this->is_whitespace_character(s[i]))
            {
                st+=s[i];
            }
        }
        return st;
    }

    bool is_whitespace_character(char c)
    {
        return (c == ' ')
               || (c == '\t')
               || (c == '\n')
               || (c == '\r')
               || (c == '\f');
    }


public:
    Mafft_alignment();
    bool test_executable();
    void align_sequences(std::vector<std::string> *names,std::vector<std::string> *sequences);
};

#endif // MAFFT_ALIGNMENT_H