JAL-2505 set helix number as feature group in SequenceFeature
[jalview.git] / src / jalview / analysis / TreeModel.java
index 2f8d788..5a41802 100644 (file)
@@ -46,7 +46,7 @@ public class TreeModel
    * SequenceData is a string representation of what the user
    * sees. The display may contain hidden columns.
    */
-  public AlignmentView seqData;
+  private AlignmentView seqData;
 
   int noseqs;
 
@@ -68,7 +68,7 @@ public class TreeModel
 
   /**
    * Create a new TreeModel object with leaves associated with sequences in
-   * seqs, and original alignment data represented by Cigar strings
+   * seqs, and (optionally) original alignment data represented by Cigar strings
    * 
    * @param seqs
    *          SequenceI[]
@@ -79,22 +79,9 @@ public class TreeModel
    */
   public TreeModel(SequenceI[] seqs, AlignmentView odata, NewickFile treefile)
   {
-    this(seqs, treefile);
-    seqData = odata;
-  }
-
-  /**
-   * Creates a new TreeModel object from a tree from an external source
-   * 
-   * @param seqs
-   *          SequenceI which should be associated with leafs of treefile
-   * @param treefile
-   *          A parsed tree
-   */
-  public TreeModel(SequenceI[] seqs, NewickFile treefile)
-  {
     this(seqs, treefile.getTree(), treefile.HasDistances(), treefile
             .HasBootstrap(), treefile.HasRootDistance());
+    seqData = odata;
 
     associateLeavesToSequences(seqs);
   }
@@ -108,6 +95,7 @@ public class TreeModel
   {
     this(tree.getSequences(), tree.getTopNode(), tree.hasDistances(), tree
             .hasBootstrap(), tree.hasRootDistance());
+    seqData = tree.getOriginalData();
   }
 
   /**
@@ -468,39 +456,6 @@ public class TreeModel
   }
 
   /**
-   * 
-   * @return true if original sequence data can be recovered
-   */
-  public boolean hasOriginalSequenceData()
-  {
-    return seqData != null;
-  }
-
-  /**
-   * Returns original alignment data used for calculation - or null where not
-   * available.
-   * 
-   * @return null or cut'n'pasteable alignment
-   */
-  public String printOriginalSequenceData(char gapChar)
-  {
-    if (seqData == null)
-    {
-      return null;
-    }
-
-    StringBuffer sb = new StringBuffer();
-    String[] seqdatas = seqData.getSequenceStrings(gapChar);
-    for (int i = 0; i < seqdatas.length; i++)
-    {
-      sb.append(new jalview.util.Format("%-" + 15 + "s").form(sequences[i]
-              .getName()));
-      sb.append(" " + seqdatas[i] + "\n");
-    }
-    return sb.toString();
-  }
-
-  /**
    * DOCUMENT ME!
    * 
    * @param nd
@@ -710,4 +665,9 @@ public class TreeModel
       ;
     }
   }
+
+  public AlignmentView getOriginalData()
+  {
+    return seqData;
+  }
 }