1 Clazz.declarePackage ("jalview.appletgui");
\r
2 Clazz.load (["awt2swing.Panel", "java.awt.event.ActionListener", "awt2swing.Button", "$.ScrollPane", "$.TextArea", "java.awt.BorderLayout", "java.util.Vector"], "jalview.appletgui.PairwiseAlignPanel", ["jalview.analysis.AlignSeq", "jalview.appletgui.AlignFrame", "jalview.datamodel.Alignment", "jalview.util.Format", "$.MessageManager", "java.awt.Font"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.sequences = null;
\r
6 this.scrollPane = null;
\r
7 this.textarea = null;
\r
8 this.viewInEditorButton = null;
\r
10 this.borderLayout1 = null;
\r
11 Clazz.instantialize (this, arguments);
\r
12 }, jalview.appletgui, "PairwiseAlignPanel", awt2swing.Panel, java.awt.event.ActionListener);
\r
13 Clazz.prepareFields (c$, function () {
\r
14 this.sequences = new java.util.Vector ();
\r
15 this.scrollPane = new awt2swing.ScrollPane ();
\r
16 this.textarea = new awt2swing.TextArea ();
\r
17 this.viewInEditorButton = new awt2swing.Button ();
\r
18 this.jPanel1 = new awt2swing.Panel ();
\r
19 this.borderLayout1 = new java.awt.BorderLayout ();
\r
21 Clazz.makeConstructor (c$,
\r
23 Clazz.superConstructor (this, jalview.appletgui.PairwiseAlignPanel, []);
\r
27 if (Clazz.exceptionOf (e, Exception)) {
\r
28 e.printStackTrace ();
\r
34 this.sequences = new java.util.Vector ();
\r
36 var seqStrings = ap.av.getViewAsString (true);
\r
37 if (ap.av.getSelectionGroup () == null) {
\r
38 seqs = ap.av.getAlignment ().getSequencesArray ();
\r
40 seqs = ap.av.getSelectionGroup ().getSequencesInOrder (ap.av.getAlignment ());
\r
41 }var scores = Clazz.newFloatArray (seqs.length, seqs.length, 0);
\r
43 var count = ap.av.getSelectionGroup ().getSize ();
\r
44 var type = (ap.av.getAlignment ().isNucleotide ()) ? "dna" : "pep";
\r
46 for (var i = 1; i < count; i++) {
\r
47 for (var j = 0; j < i; j++) {
\r
48 var as = new jalview.analysis.AlignSeq (seqs[i], seqStrings[i], seqs[j], seqStrings[j], type);
\r
49 if (as.s1str.length == 0 || as.s2str.length == 0) {
\r
51 }as.calcScoreMatrix ();
\r
52 as.traceAlignment ();
\r
53 as.printAlignment (System.out);
\r
54 scores[i][j] = as.getMaxScore () / as.getASeq1 ().length;
\r
55 totscore = totscore + scores[i][j];
\r
56 this.textarea.append (as.getOutput ());
\r
57 this.sequences.add (as.getAlignedSeq1 ());
\r
58 this.sequences.add (as.getAlignedSeq1 ());
\r
62 System.out.println ("Pairwise alignment scaled similarity score matrix\n");
\r
63 for (var i = 0; i < count; i++) {
\r
64 jalview.util.Format.print (System.out, "%s \n", ("" + i) + " " + seqs[i].getName ());
\r
66 System.out.println ("\n");
\r
67 for (var i = 0; i < count; i++) {
\r
68 for (var j = 0; j < i; j++) {
\r
69 jalview.util.Format.printDouble (System.out, "%7.3f", scores[i][j] / totscore);
\r
72 System.out.println ("\n");
\r
73 }}, "jalview.appletgui.AlignmentPanel");
\r
74 Clazz.overrideMethod (c$, "actionPerformed",
\r
76 if (evt.getSource () === this.viewInEditorButton) {
\r
77 this.viewInEditorButton_actionPerformed ();
\r
78 }}, "java.awt.event.ActionEvent");
\r
79 Clazz.defineMethod (c$, "viewInEditorButton_actionPerformed",
\r
81 var seq = new Array (this.sequences.size ());
\r
82 for (var i = 0; i < this.sequences.size (); i++) {
\r
83 seq[i] = this.sequences.elementAt (i);
\r
85 new jalview.appletgui.AlignFrame ( new jalview.datamodel.Alignment (seq), this.ap.av.applet, "Pairwise Aligned Sequences", false);
\r
87 Clazz.defineMethod (c$, "jbInit",
\r
88 ($fz = function () {
\r
89 this.setLayout (this.borderLayout1);
\r
90 this.textarea.setFont ( new java.awt.Font ("Monospaced", 0, 12));
\r
91 this.textarea.setText ("");
\r
92 this.viewInEditorButton.setFont ( new java.awt.Font ("Verdana", 0, 12));
\r
93 this.viewInEditorButton.setLabel (jalview.util.MessageManager.getString ("label.view_alignment_editor"));
\r
94 this.viewInEditorButton.addActionListener (this);
\r
95 this.add (this.scrollPane, "Center");
\r
96 this.scrollPane.add (this.textarea);
\r
97 this.add (this.jPanel1, "South");
\r
98 this.jPanel1.add (this.viewInEditorButton, null);
\r
99 }, $fz.isPrivate = true, $fz));
\r