source: tags/arb_5.3/ALIV3/a3_ali.cxx

Last change on this file was 3482, checked in by westram, 19 years ago
  • tabs → spaces
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1// -----------------------------------------------------------------------------
2//  Include-Dateien
3// -----------------------------------------------------------------------------
4
5#include <cstring>
6#include <fstream>
7#include <iostream>
8
9#include "a3_ali.hxx"
10
11using std::cout;
12
13// -----------------------------------------------------------------------------
14int psolcmp ( const void *a,
15                  const void *b )
16// -----------------------------------------------------------------------------
17{
18    int res  = 0,
19        diff = (*(PSolution**)a)->score - (*(PSolution**)b)->score;
20   
21    if      (diff < 0) res = -1;
22    else if (diff > 0) res =  1;
23
24    return res;
25}
26
27// -----------------------------------------------------------------------------
28    void psoldump ( vp val )
29// -----------------------------------------------------------------------------
30{
31    PSolution *psol = (PSolution*)val;
32
33    if (psol)
34    {
35        cout << psol->score << "\n";
36   
37        psol->match.Dump(hmatchdump);
38    }
39}
40
41// -----------------------------------------------------------------------------
42    void PSolution::Dump ( void )
43// -----------------------------------------------------------------------------
44{
45    psoldump((vp)this);
46}
47
48// -----------------------------------------------------------------------------
49    Aligner::Aligner ( void ) : postree(), prealigned(), helix()
50// -----------------------------------------------------------------------------
51{
52    prealigned.Sort(intcmp);
53}
54
55// -----------------------------------------------------------------------------
56    Aligner::Aligner ( str     seq,
57                       str     hel,
58                       str     kon,
59                       DArray &pre ) : postree(seq),
60                                       prealigned(pre),
61                                       helix(hel,kon,
62                                             ((PSolution*)pre[pre.Elements() - 1])->match)
63// -----------------------------------------------------------------------------
64{
65}
66
67// -----------------------------------------------------------------------------
68    void Aligner::Set ( str     seq,
69                        str     hel,
70                        str     kon,
71                        DArray &pre )
72// -----------------------------------------------------------------------------
73{
74    postree.Set(seq);
75
76    prealigned.Clear();
77    prealigned = pre;
78}
79
80// -----------------------------------------------------------------------------
81    DArray &Aligner::Align ( void )
82// -----------------------------------------------------------------------------
83{
84    DArray *array = new DArray;
85    int    anz    = prealigned.Elements();
86
87    helix.Set(((PSolution*)prealigned[anz - 1])->match);
88
89    {
90        DArray &tmp = helix.Helices(1,10);
91           
92        delete &tmp;
93    }
94   
95    return *array;
96}
97
98// -----------------------------------------------------------------------------
99    void Aligner::Dump ( void )
100// -----------------------------------------------------------------------------
101{
102    postree.Show(2);
103    prealigned.Dump(psoldump);
104    helix.Dump(1);
105}
Note: See TracBrowser for help on using the repository browser.