File: export_gap_extender.cc

package info (click to toggle)
promod3 3.4.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 966,596 kB
  • sloc: cpp: 55,820; python: 18,058; makefile: 85; sh: 51
file content (117 lines) | stat: -rw-r--r-- 4,508 bytes parent folder | download | duplicates (3)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (c) 2013-2020, SIB - Swiss Institute of Bioinformatics and
//                          Biozentrum - University of Basel
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#include <boost/python.hpp>
#include <promod3/modelling/gap_extender.hh>
#include <promod3/core/export_helper.hh>

using namespace ost;
using namespace boost::python;
using namespace promod3;
using namespace promod3::modelling;

namespace {

  GapExtenderPtr wrap_ExtenderInitOne(StructuralGap& gap, 
                                      const String& seqres)
  {
    GapExtenderPtr extender(new GapExtender(gap, seqres));
    return extender;
  }

  GapExtenderPtr wrap_ExtenderInitTwo(StructuralGap& gap,
                                      const ost::seq::SequenceHandle& seqres)
  {
    GapExtenderPtr extender(new GapExtender(gap, seqres));
    return extender;
  }
  
  ScoringGapExtenderPtr wrap_ScoringExtenderInitOneB(StructuralGap& gap,
                                                     Real extension_penalty,
                                                     list& penalties,
                                                     const String& seqres,
                                                     const int max_length=-2)
  {
    std::vector<Real> v_penalties;
    core::ConvertListToVector(penalties, v_penalties);
    ScoringGapExtenderPtr extender(
      new ScoringGapExtender(gap, extension_penalty, v_penalties,
                             seqres, max_length));
    return extender;
  }

  ScoringGapExtenderPtr wrap_ScoringExtenderInitOne(StructuralGap& gap,
                                                    Real extension_penalty,
                                                    list& penalties,
                                                    const String& seqres)
  {
    return wrap_ScoringExtenderInitOneB(gap, extension_penalty, penalties, seqres);
  }

  ScoringGapExtenderPtr wrap_ScoringExtenderInitTwoB(
                              StructuralGap& gap,
                              Real extension_penalty,
                              list& penalties,
                              const ost::seq::SequenceHandle& seqres,
                              const int max_length=-2)
  {
    std::vector<Real> v_penalties;
    core::ConvertListToVector(penalties, v_penalties);
    ScoringGapExtenderPtr extender(
      new ScoringGapExtender(gap, extension_penalty, v_penalties,
                             seqres, max_length));
    return extender;
  }

  ScoringGapExtenderPtr wrap_ScoringExtenderInitTwo(
                              StructuralGap& gap,
                              Real extension_penalty,
                              list& penalties,
                              const ost::seq::SequenceHandle& seqres)
  {
    return wrap_ScoringExtenderInitTwoB(gap, extension_penalty, penalties, seqres);
  }
}


void export_gap_extender()
{

  class_<GapExtender>("GapExtender", no_init)
    .def("__init__",make_constructor(wrap_ExtenderInitOne))
    .def("__init__",make_constructor(wrap_ExtenderInitTwo))
    .def("Extend", &GapExtender::Extend)
  ;
  register_ptr_to_python<GapExtenderPtr>();

  class_<FullGapExtender>("FullGapExtender", no_init)
    .def(init<StructuralGap&, const String&, const int>(
         (arg("gap"), arg("seqres"), arg("max_length")=-1)))
    .def(init<StructuralGap&, const ost::seq::SequenceHandle&, const int>(
         (arg("gap"), arg("seqres"), arg("max_length")=-1)))
    .def("Extend", &FullGapExtender::Extend)
  ;
  register_ptr_to_python<FullGapExtenderPtr>();
  
  class_<ScoringGapExtender>("ScoringGapExtender", no_init)
     .def("__init__",make_constructor(wrap_ScoringExtenderInitOne))
     .def("__init__",make_constructor(wrap_ScoringExtenderInitTwo))
     .def("__init__",make_constructor(wrap_ScoringExtenderInitOneB))
     .def("__init__",make_constructor(wrap_ScoringExtenderInitTwoB))
     .def("Extend", &ScoringGapExtender::Extend)
  ;
  register_ptr_to_python<ScoringGapExtenderPtr>();
}