File: RunMultiple.java

package info (click to toggle)
proalign 0.603-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 480 kB
  • ctags: 847
  • sloc: java: 8,673; sh: 15; makefile: 9
file content (103 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download | duplicates (4)
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
/**
 * Title:        ProAlign<p>
 * Description:  <p>
 * Copyright:    Copyright (c) Ari Loytynoja<p>
 * License:      GNU GENERAL PUBLIC LICENSE<p>
 * @see          http://www.gnu.org/copyleft/gpl.html
 * Company:      ULB<p>
 * @author Ari Loytynoja
 * @version 1.0
 */
package proalign;

import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.io.DataInputStream;
import java.io.BufferedInputStream;

/**
 * Running alignment in a separate thread
 */
public class RunMultiple extends Thread {

    ResultWindow rw;

    RunMultiple(ResultWindow rw) {
	
	this.rw = rw;

	ProAlign.log("RunMultiple");

	start();
    }

    public void run() {

	boolean isError = false;
	String errorMsg = new String();

	try {
	    rw.root.align();
	} catch(TraceBackException tbe) { 
	    isError = true;
	    errorMsg = tbe.getMessage();
	} catch(Exception e) { }

	if(isError) {
	    
	    OpenDialog od = new OpenDialog(rw);
	    od.showDialog("Error!", "\n  "+errorMsg+"\n  Try to increase the band width.\n");

	    rw.file[1].setEnabled(true); // open alignment
	    rw.file[2].setEnabled(false); // save alignment
	    rw.data[0].setEnabled(true); // import data
	    rw.data[1].setEnabled(true); // import guide tree
	    rw.align[0].setEnabled(true); // do guide tree  NOT YET
	    rw.align[1].setEnabled(true); // do multiple
	    rw.align[2].setEnabled(true); // do complete  NOT YET
	    rw.align[3].setEnabled(true); // sample
	    rw.align[4].setEnabled(false); // remove gaps
	    
	    rw.dm.setEnabled(true); // import
	    rw.em.setEnabled(false); // export 

	} else {
	    
	    rw.setAlignedData(rw.root);
	    rw.setScrollPanes();
	    
	    if(rw.root.isBandWarning()) {
		String text = new String(
		    "\n  Traceback path came very close\n  to the band edge."+
		    " Alignment may\n  not be the correct one!");
		OpenDialog od = new OpenDialog(rw);
		od.showDialog("Warning!",text);
	    }
	    
	    if(!rw.root.isUnique()) {
		String text = new String(
		    "\n  There exist more than one possible\n  alignment. The backtrace "+
		    "path was\n  chosen "+rw.root.getSampleTimes()+" times randomly between\n"+
		    "  two equally good alternatives.\n");
		OpenDialog od = new OpenDialog(rw);
		od.showDialog("Notice!",text);	 
	    }
	}
    }
}