JAL-3365 expand range of allowed DSSP secondary structure symbols in Stockholm files
[jalview.git] / src / jalview / io / PfamFile.java
index 667da9f..6b9dc3f 100755 (executable)
@@ -36,9 +36,10 @@ public class PfamFile extends AlignFile
   {
   }
 
-  public PfamFile(String inFile, String type) throws IOException
+  public PfamFile(String inFile, DataSourceType sourceType)
+          throws IOException
   {
-    super(inFile, type);
+    super(inFile, sourceType);
   }
 
   public PfamFile(FileParse source) throws IOException
@@ -116,23 +117,22 @@ public class PfamFile extends AlignFile
 
     if (noSeqs < 1)
     {
-      throw new IOException(
-              MessageManager.getString("exception.pfam_no_sequences_found"));
+      throw new IOException(MessageManager
+              .getString("exception.pfam_no_sequences_found"));
     }
 
     for (i = 0; i < headers.size(); i++)
     {
       if (seqhash.get(headers.get(i)) != null)
       {
-        if (maxLength < seqhash.get(headers.get(i)).toString()
-                .length())
+        if (maxLength < seqhash.get(headers.get(i)).toString().length())
         {
           maxLength = seqhash.get(headers.get(i)).toString().length();
         }
 
         Sequence newSeq = parseId(headers.get(i).toString());
-        newSeq.setSequence(seqhash.get(headers.get(i).toString())
-                .toString());
+        newSeq.setSequence(
+                seqhash.get(headers.get(i).toString()).toString());
         seqs.addElement(newSeq);
       }
       else
@@ -143,7 +143,8 @@ public class PfamFile extends AlignFile
     }
   }
 
-  public String print(SequenceI[] s)
+  @Override
+  public String print(SequenceI[] s, boolean jvsuffix)
   {
     StringBuffer out = new StringBuffer("");
 
@@ -154,12 +155,9 @@ public class PfamFile extends AlignFile
 
     while ((i < s.length) && (s[i] != null))
     {
-      String tmp = printId(s[i]);
+      String tmp = printId(s[i], jvsuffix);
 
-      if (s[i].getSequence().length > max)
-      {
-        max = s[i].getSequence().length;
-      }
+      max = Math.max(max, s[i].getLength());
 
       if (tmp.length() > maxid)
       {
@@ -178,7 +176,8 @@ public class PfamFile extends AlignFile
 
     while ((j < s.length) && (s[j] != null))
     {
-      out.append(new Format("%-" + maxid + "s").form(printId(s[j]) + " "));
+      out.append(new Format("%-" + maxid + "s")
+              .form(printId(s[j], jvsuffix) + " "));
 
       out.append(s[j].getSequenceAsString());
       out.append(newline);
@@ -189,10 +188,4 @@ public class PfamFile extends AlignFile
 
     return out.toString();
   }
-
-  @Override
-  public String print()
-  {
-    return print(getSeqsAsArray());
-  }
 }