source: trunk/GDE/SINA/builddir/src/query_pt.h

Last change on this file was 19170, checked in by westram, 2 years ago
  • sina source
    • unpack + remove tarball
    • no longer ignore sina builddir.
File size: 5.4 KB
Line 
1/*
2Copyright (c) 2006-2018 Elmar Pruesse <elmar.pruesse@ucdenver.edu>
3
4This file is part of SINA.
5SINA is free software: you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free
7Software Foundation, either version 3 of the License, or (at your
8option) any later version.
9
10SINA is distributed in the hope that it will be useful, but WITHOUT ANY
11WARRANTY; without even the implied warranty of MERCHANTABILITY or
12FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13for more details.
14
15You should have received a copy of the GNU General Public License
16along with SINA.  If not, see <http://www.gnu.org/licenses/>.
17
18Additional permission under GNU GPL version 3 section 7
19
20If you modify SINA, or any covered work, by linking or combining it
21with components of ARB (or a modified version of that software),
22containing parts covered by the terms of the
23ARB-public-library-license, the licensors of SINA grant you additional
24permission to convey the resulting work. Corresponding Source for a
25non-source form of such a combination shall include the source code
26for the parts of ARB used as well as that of the covered work.
27*/
28
29#ifndef _QUERY_PT_H_
30#define _QUERY_PT_H_
31
32#include "search.h"
33
34#include <exception>
35
36#include <boost/program_options.hpp>
37#include <boost/filesystem.hpp>
38
39namespace sina {
40
41class query_pt_exception : public std::exception {
42    std::string message;
43public:
44    query_pt_exception(std::string  msg) noexcept;
45    ~query_pt_exception() noexcept override;
46    const char* what() const noexcept override;
47};
48
49class query_pt_pool : public search {
50    struct pimpl;
51    std::shared_ptr<pimpl> impl;
52public:
53    static query_pt_pool* get_pool(boost::filesystem::path filename,
54                            int k=10, bool fast=true, bool norel=false, int mk=0,
55                            std::string portname="");
56    query_pt_pool(std::shared_ptr<pimpl>);
57    ~query_pt_pool() override;
58private:
59    query_pt_pool() = delete;
60    query_pt_pool(const query_pt_pool&) = delete;
61
62
63    void find(const cseq& query, result_vector& results, unsigned int max) override;
64
65    double match(result_vector &family,
66                 const cseq& queryc,
67                 int min_match,
68                 int max_match,
69                 float min_score,
70                 float max_score,
71                 query_arb *arb,
72                 bool noid,
73                 int min_len,
74                 int num_full,
75                 int full_min_len,
76                 int range_cover,
77                 bool leave_query_out) override;
78
79    unsigned int size() const override;
80};
81
82class query_pt : public search {
83public:
84    static query_pt* get_pt_search(const boost::filesystem::path& filename,
85                                   int k=10,
86                                   bool fast=true,
87                                   bool norel=false,
88                                   int mk=0,
89                                   std::string portname="");
90
91    query_pt(const char* portname,
92             const char* dbname,
93             bool fast=true,
94             int k=10,
95             int mk=0,
96             bool norel=false);
97    ~query_pt() override;
98
99    void find(const cseq& query, result_vector& results, unsigned int max) override;
100    unsigned int size() const override;
101
102    /**
103     * match runs a word search using the PT server
104     *
105     * arguments:
106     *  family:    will contain scored results
107     *  query:     query sequence
108     *  min_match: minimum number of results required
109     *  max_match: maximum number of results desired
110     *  min_score: minimum relative score
111     *  max_score: maximum relative score
112     *  arb:       pointer to matching arb database
113     *  noid:      skip matches containing query
114     *  min_len:   skip matches shorter
115     *  num_full:  minimum "full length", ignoring score
116     *  minlen_full: length to be considered "full"
117     *  range_cover: minimum sequences touching alignment edge
118     *  leave_query_out: drop sequence with matching id
119     */
120    double match(result_vector &family,
121                 const cseq& queryc,
122                 int min_match,
123                 int max_match,
124                 float min_score,
125                 float max_score,
126                 query_arb *arb,
127                 bool noid,
128                 int min_len,
129                 int num_full,
130                 int full_min_len,
131                 int range_cover,
132                 bool leave_query_out) override;
133
134    void set_find_type_fast(bool fast);
135    void set_probe_len(int len);
136    void set_mismatches(int len);
137    void set_sort_type(bool absolute);
138    void set_range(int startpos=-1, int stoppos=-1);
139    void unset_range();
140
141    static void get_options_description(boost::program_options::options_description& all,
142                                        boost::program_options::options_description& adv);
143    static void validate_vm(boost::program_options::variables_map& /*unused*/,
144                            boost::program_options::options_description& /*unused*/);
145
146private:
147    struct priv_data;
148    priv_data *data;
149    struct options;
150    static struct options *opts;
151};
152
153} // namespace sina
154
155#endif // _QUERY_PT_H_
156
157/*
158  Local Variables:
159  mode:c++
160  c-file-style:"stroustrup"
161  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . 0))
162  indent-tabs-mode:nil
163  fill-column:99
164  End:
165*/
166// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
Note: See TracBrowser for help on using the repository browser.