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