Multiple Views
[jalview.git] / src / jalview / gui / PairwiseAlignPanel.java
index f52a1d8..248a54c 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
@@ -54,7 +54,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
         sequences = new Vector();\r
 \r
         SequenceI [] seqs;\r
-        String []  seqStrings = av.getSelectionAsString();\r
+        String []  seqStrings = av.getViewAsString(true);\r
 \r
         if(av.getSelectionGroup()==null)\r
         {\r
@@ -70,20 +70,25 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
         double totscore = 0;\r
         int count = seqs.length;\r
 \r
-        int acount = 0;\r
         Sequence seq;\r
 \r
         for (int i = 1; i < count; i++)\r
         {\r
             for (int j = 0; j < i; j++)\r
             {\r
-                acount++;\r
 \r
                 AlignSeq as = new AlignSeq(seqs[i], seqStrings[i],\r
                         seqs[j], seqStrings[j], "pep");\r
 \r
+                if(as.s1str.length()==0 || as.s2str.length()==0)\r
+                {\r
+                  continue;\r
+                }\r
+\r
                 as.calcScoreMatrix();\r
                 as.traceAlignment();\r
+\r
+\r
                 as.printAlignment(System.out);\r
                 scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
                 totscore = totscore + scores[i][j];\r
@@ -91,7 +96,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
                 textarea.append(as.getOutput());\r
                 seq = new Sequence(as.getS1().getName(),\r
                                    as.getAStr1(),\r
-                    as.getS1().getStart(), as.getS1().getEnd()\r
+                                   as.getS1().getStart(),\r
+                                   as.getS1().getEnd()\r
                 );\r
                 sequences.add(seq);\r
 \r
@@ -144,8 +150,11 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel
             seq[i] = (Sequence) sequences.elementAt(i);\r
         }\r
 \r
-        AlignFrame af = new AlignFrame(new Alignment(seq));\r
+        AlignFrame af = new AlignFrame(new Alignment(seq),\r
+                                           AlignFrame.DEFAULT_WIDTH,\r
+                                           AlignFrame.DEFAULT_HEIGHT);\r
+\r
         Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",\r
-            AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+            AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);\r
     }\r
 }\r