~ubuntu-branches/debian/jessie/arb/jessie

« back to all changes in this revision

Viewing changes to SECEDIT/SEC_structure.cxx

  • Committer: Package Import Robot
  • Author(s): Elmar Pruesse, Andreas Tille, Elmar Pruesse
  • Date: 2014-09-02 15:15:06 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140902151506-jihq58b3iz342wif
Tags: 6.0.2-1
[ Andreas Tille ]
* New upstream version
  Closes: #741890
* debian/upstream -> debian/upstream/metadata
* debian/control:
   - Build-Depends: added libglib2.0-dev
   - Depends: added mafft, mrbayes
* debian/rules
   - Add explicite --remove-section=.comment option to manual strip call
* cme fix dpkg-control
* arb-common.dirs: Do not create unneeded lintian dir
* Add turkish debconf translation (thanks for the patch to Mert Dirik
  <mertdirik@gmail.com>)
  Closes: #757497

[ Elmar Pruesse ]
* patches removed:
   - 10_config.makefiles.patch,
     80_no_GL.patch
       removed in favor of creating file from config.makefile.template via 
       sed in debian/control
   - 20_Makefile_main.patch
       merged upstream
   - 21_Makefiles.patch
       no longer needed
   - 30_tmpfile_CVE-2008-5378.patch: 
       merged upstream
   - 50_fix_gcc-4.8.patch:
       merged upstream
   - 40_add_libGLU.patch:
       libGLU not needed for arb_ntree)
   - 60_use_debian_packaged_raxml.patch:
       merged upstream
   - 70_hardening.patch
       merged upstream
   - 72_add_math_lib_to_linker.patch
       does not appear to be needed
* patches added:
   - 10_upstream_r12793__show_db_load_progress:
       backported patch showing progress while ARB is loading a database
       (needed as indicator/splash screen while ARB is launching)
   - 20_upstream_r12794__socket_permissions:
       backported security fix
   - 30_upstream_r12814__desktop_keywords:
       backported add keywords to desktop (fixes lintian warning)
   - 40_upstream_r12815__lintian_spelling:
       backported fix for lintian reported spelling errors
   - 50_private_nameservers
       change configuration to put nameservers into users home dirs
       (avoids need for shared writeable directory)
   - 60_use_debian_phyml
       use phyml from debian package for both interfaces in ARB
* debian/rules:
   - create config.makefile from override_dh_configure target
   - use "make tarfile" in override_dh_install
   - remove extra cleaning not needed for ARB 6
   - use "dh_install --list-missing" to avoid missing files
   - added override_dh_fixperms target
* debian/control:
   - added libarb-dev package
   - Depends: added phyml, xdg-utils
   - Suggests: removed phyml
   - fix lintian duplicate-short-description (new descriptions)
* debian/*.install:
   - "unrolled" confusing globbing to select files
   - pick files from debian/tmp
   - moved all config files to /etc/arb
* debian/arb-common.templates: updated
* scripts:
   - removed arb-add-pt-server
   - launch-wrapper: 
     - only add demo.arb to newly created $ARBUSERDATA
     - pass commandline arguments through bin/arb wrapper
   - preinst: removing old PT server index files on upgrade from 5.5*
   - postinst: set setgid on shared PT dir
* rewrote arb.1 manfile
* added file icon for ARB databases
* using upstream arb_tcp.dat

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
using namespace std;
16
16
 
17
 
// ---------------------
 
17
// ----------------------
18
18
//      Constructors
19
 
// ---------------------
20
19
 
21
20
SEC_segment::SEC_segment()
22
 
    : alpha(0)
23
 
    , center1(Origin)
24
 
    , center2(Origin)
25
 
    , next_helix_strand(0)
26
 
    , loop(0)
 
21
    : alpha(0),
 
22
      center1(Origin),
 
23
      center2(Origin),
 
24
      next_helix_strand(0),
 
25
      loop(0)
27
26
{}
28
27
 
29
28
SEC_helix_strand::SEC_helix_strand()
30
 
    : origin_loop(0)
31
 
    , other_strand(0)
32
 
    , helix_info(0)
33
 
    , next_segment(0)
34
 
    , fixpoint(Origin)
35
 
    , rightAttach(Origin)
36
 
    , leftAttach(Origin)
 
29
    : origin_loop(0),
 
30
      other_strand(0),
 
31
      helix_info(0),
 
32
      next_segment(0),
 
33
      fixpoint(Origin),
 
34
      rightAttach(Origin),
 
35
      leftAttach(Origin)
37
36
{}
38
37
 
39
38
SEC_loop::SEC_loop(SEC_root *root_)
40
 
    : SEC_base(root_)
41
 
    , Circumferance(0)
42
 
    , center(0, 0)
43
 
    , primary_strand(0)
 
39
    : SEC_base(root_),
 
40
      Circumference(0),
 
41
      center(0, 0),
 
42
      primary_strand(0)
44
43
{}
45
44
 
46
45
SEC_helix::SEC_helix(SEC_root *root_, SEC_helix_strand *to_root, SEC_helix_strand *from_root)
47
 
    : SEC_base(root_)
48
 
    , strand_to_root(to_root)
49
 
    , base_length(0)
 
46
    : SEC_base(root_),
 
47
      strand_to_root(to_root),
 
48
      base_length(0)
50
49
{
51
50
    sec_assert(to_root->get_helix()     == 0);
52
51
    sec_assert(from_root->get_helix()   == 0);
62
61
 
63
62
 
64
63
SEC_root::SEC_root()
65
 
    : root_loop(0)
66
 
    , cursorAbsPos(-1)
67
 
    , xString(0)
68
 
    , constructing(false)
69
 
    , db(0)
70
 
    , bg_color(0)
71
 
    , autoscroll(0)
72
 
    , nailedAbsPos(-1)
73
 
    , drawnPositions(0)
74
 
    , cursor_line(LineVector(Origin, ZeroVector))
75
 
    , show_constraints(SEC_NO_TYPE)
 
64
    : root_loop(0),
 
65
      cursorAbsPos(-1),
 
66
      xString(0),
 
67
      constructing(false),
 
68
      db(0),
 
69
      bg_color(0),
 
70
      autoscroll(0),
 
71
      nailedAbsPos(-1),
 
72
      drawnPositions(0),
 
73
      cursor_line(LineVector(Origin, ZeroVector)),
 
74
      show_constraints(SEC_NO_TYPE)
76
75
{
77
 
}
78
 
 
79
 
 
80
 
void SEC_root::init(SEC_graphic *gfx, AWT_canvas *ntw) {
81
 
    // canvas   = ntw;
82
 
    db = new SEC_db_interface(gfx, ntw);
83
 
}
84
 
 
85
 
// --------------------
 
76
    for (int i = 0; i<SEC_GC_DATA_COUNT; ++i) {
 
77
        charRadius[i]   = -1.0;
 
78
        bg_linewidth[i] = -1.0;
 
79
    }
 
80
}
 
81
 
 
82
void SEC_root::init(SEC_graphic *gfx, AWT_canvas *scr, ED4_plugin_host& Host) {
 
83
    db = new SEC_db_interface(gfx, scr, Host);
 
84
}
 
85
 
 
86
// ---------------------
86
87
//      Destructors
87
 
// --------------------
88
88
 
89
89
SEC_region::SEC_region(int start, int end)
90
90
    : sequence_start(start)
91
91
    , sequence_end(end)
92
92
    , baseCount(-1)
93
93
    , abspos_array(NULL)
94
 
#if defined(DEBUG)
 
94
#if defined(ASSERTION_USED)
95
95
    , abspos_array_size(0)
96
 
#endif // DEBUG
 
96
#endif // ASSERTION_USED
97
97
{
98
98
    sec_assert((start == -1 && end == -1) || start != end);
99
99
}
108
108
 
109
109
 
110
110
SEC_helix_strand::~SEC_helix_strand() {
111
 
    if(next_segment != NULL) {
 
111
    if (next_segment != NULL) {
112
112
        next_segment->delete_pointer_2(this);
113
113
    }
114
114
 
161
161
            }
162
162
        }
163
163
        // delete all segments connected to loop
164
 
        for (j=0; j<i; j++) delete segment[j];        
 
164
        for (j=0; j<i; j++) delete segment[j];
165
165
    }
166
166
}
167
167
 
176
176
    delete_announced_positions();
177
177
}
178
178
 
179
 
// -------------------------
 
179
// --------------------------
180
180
//      integrity checks
181
 
// -------------------------
182
181
 
183
182
#if defined(CHECK_INTEGRITY)
184
183
 
228
227
 
229
228
void SEC_helix::check_integrity(SEC_CHECK_TYPE what) const {
230
229
    sec_assert(strand_to_root);
231
 
    
 
230
 
232
231
    SEC_helix_strand *other_strand = strand_to_root->get_other_strand();
233
232
    sec_assert(other_strand);
234
233
 
243
242
        sec_assert(base_length >= 1);
244
243
        sec_assert(drawnSize() >= 0);
245
244
    }
246
 
    
 
245
 
247
246
    strand_to_root->check_integrity(what);
248
247
    other_strand->check_integrity(what);
249
248
}
262
261
        if (what&CHECK_STRUCTURE) {
263
262
            sec_assert(this == strand->get_origin_loop());
264
263
        }
265
 
        
 
264
 
266
265
        const SEC_helix *helix = strand->get_helix();
267
266
        if (this == helix->rootsideLoop()) { // test outgoing helixes
268
267
            helix->check_integrity(what);
270
269
        else {
271
270
            rootStrands++;
272
271
        }
273
 
        
 
272
 
274
273
        const SEC_segment *seg = strand->get_next_segment();
275
274
 
276
275
        if (what&CHECK_STRUCTURE) {
295
294
    }
296
295
 
297
296
    if (what&CHECK_SIZE) {
298
 
        sec_assert(Circumferance>0);
 
297
        sec_assert(Circumference>0);
299
298
        sec_assert(drawnSize()>0);
300
299
    }
301
300
    if (what&CHECK_POSITIONS) {
315
314
void SEC_root::check_integrity(SEC_CHECK_TYPE what) const {
316
315
    if (root_loop) {
317
316
        sec_assert(!under_construction()); // cannot check integrity, when structure is under construction
318
 
    
 
317
 
319
318
        root_loop->check_integrity(what);
320
319
 
321
320
        // check whether structure is a ring and whether regions are correct
342
341
}
343
342
#endif // CHECK_INTEGRITY
344
343
 
345
 
// --------------------------------
 
344
// ---------------------------------
346
345
//      unlink strands/segments
347
 
// --------------------------------
348
346
 
349
347
void SEC_helix_strand::unlink(bool fromOtherStrandAsWell) {
350
348
    // if called with fromOtherStrandAsWell == false,
351
 
    // the strand-pair remains deletable 
352
 
    
 
349
    // the strand-pair remains deletable
 
350
 
353
351
    next_segment = NULL;
354
352
    origin_loop  = NULL;
355
353
 
356
354
    if (fromOtherStrandAsWell) other_strand = NULL;
357
355
}
358
356
 
359
 
void SEC_segment::unlink(void) {
 
357
void SEC_segment::unlink() {
360
358
    next_helix_strand = NULL;
361
359
}
362
360
 
363
 
// -----------------------------
 
361
// ------------------------------
364
362
//      split/merge segments
365
 
// -----------------------------
366
363
 
367
364
SEC_helix_strand *SEC_segment::split(size_t start, size_t end, SEC_segment **segment2_ptr) {
368
365
    // split segment into 'segment1 - strand - segment2'
399
396
    delete other;
400
397
}
401
398
 
402
 
// ---------------------
 
399
// ----------------------
403
400
//      Reset angles
404
 
// ---------------------
405
401
 
406
402
void SEC_loop::reset_angles() {
407
403
    for (SEC_strand_iterator strand(this); strand; ++strand) {
410
406
            strand->get_helix()->set_abs_angle(abs);
411
407
        }
412
408
    }
413
 
    set_rel_angle(0); 
 
409
    set_rel_angle(0);
414
410
}
415
411
 
416
412
void SEC_helix::reset_angles() {
422
418
}
423
419
 
424
420
 
425
 
// --------------
 
421
// ---------------
426
422
//      other
427
 
// --------------
428
423
 
429
424
size_t SEC_base_part::getNextAbspos() const {
430
425
    // returns the next valid abspos
438
433
}
439
434
 
440
435
 
441
 
SEC_segment *SEC_helix_strand::get_previous_segment(void) {
 
436
SEC_segment *SEC_helix_strand::get_previous_segment() {
442
437
    SEC_segment *segment_before;
443
438
    SEC_helix_strand *strand_pointer = next_segment->get_next_strand();
444
439
 
445
440
    if (strand_pointer == this) {
446
 
        segment_before = next_segment;   //we are in a loop with only one segment
 
441
        segment_before = next_segment;   // we are in a loop with only one segment
447
442
    }
448
443
    else {
449
444
        while (strand_pointer != this) {
474
469
            lastHelixLen++;
475
470
        }
476
471
    }
477
 
    
478
 
    if (lastHelixLen>longestLength) {
479
 
        longestLength  = lastHelixLen;
480
 
        longestHelixNr = lastHelixNr;
481
 
    }
 
472
 
 
473
    if (lastHelixLen>longestLength) longestHelixNr = lastHelixNr;
482
474
 
483
475
    sec_assert(longestHelixNr);
484
476
    start1 = helix->first_position(longestHelixNr);
491
483
    // create default structure
492
484
 
493
485
    set_under_construction(true);
494
 
    
 
486
 
495
487
    SEC_loop *loop1 = new SEC_loop(this);
496
488
    SEC_loop *loop2 = new SEC_loop(this);
497
489
 
525
517
 
526
518
    strand1->set_sequence_portion(start1, end1+1); segment2->set_sequence_portion(end1+1, start2);
527
519
    strand2->set_sequence_portion(start2, end2+1); segment1->set_sequence_portion(end2+1, start1);
528
 
    
 
520
 
529
521
    root_loop = helix->rootsideLoop();
530
 
    
 
522
 
531
523
    loop1->set_rel_angle(0);
532
524
    loop2->set_rel_angle(0);
533
525
    helix->set_rel_angle(0);