X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFileFormat.java;h=770f76299e2995fc44b0eb5afd9855b133ed71d3;hb=74b531f56bbaad5c5e06a4744980256fe8110923;hp=a7113f637bd2ca03625026c2c8328e30050c8a86;hpb=8b27085fa7fc5f2877e078421284c2636b85b8c6;p=jalview.git diff --git a/src/jalview/io/FileFormat.java b/src/jalview/io/FileFormat.java index a7113f6..770f762 100644 --- a/src/jalview/io/FileFormat.java +++ b/src/jalview/io/FileFormat.java @@ -5,12 +5,14 @@ import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public enum FileFormat implements FileFormatI { - Fasta("FASTA", "fa, fasta, mfa, fastq", true, true) + Fasta("Fasta", "fa, fasta, mfa, fastq", true, true) { @Override public AlignmentFileI getAlignmentFile(String inFile, @@ -54,7 +56,7 @@ public enum FileFormat implements FileFormatI return new PfamFile(); } }, - Stockholm("STH", "sto,stk", true, true) + Stockholm("Stockholm", "sto,stk", true, true) { @Override public AlignmentFileI getAlignmentFile(String inFile, @@ -118,6 +120,28 @@ public enum FileFormat implements FileFormatI return new BLCFile(); } }, + AMSA("AMSA", "amsa", true, true) + { + @Override + public AlignmentFileI getAlignmentFile(String inFile, + DataSourceType sourceType) throws IOException + { + return new AMSAFile(inFile, sourceType); + } + + @Override + public AlignmentFileI getAlignmentFile(FileParse source) + throws IOException + { + return new AMSAFile(source); + } + + @Override + public AlignmentFileI getAlignmentFile() + { + return new BLCFile(); + } + }, Html("HTML", "html", true, false) { @Override @@ -193,7 +217,7 @@ public enum FileFormat implements FileFormatI } }, - Pileup("PileUp", "?", false, false) + Pileup("PileUp", "pileup", false, true) { @Override public AlignmentFileI getAlignmentFile(String inFile, @@ -235,7 +259,7 @@ public enum FileFormat implements FileFormatI } }, - Clustal("CLUSTAL", "aln", true, true) + Clustal("Clustal", "aln", true, true) { @Override public AlignmentFileI getAlignmentFile(String inFile, @@ -465,6 +489,44 @@ public enum FileFormat implements FileFormatI private String name; + /** + * Answers a list of writeable file formats (as string, corresponding to the + * toString() and forName() methods) + * + * @return + */ + public static List getWritableFormats() + { + List l = new ArrayList(); + for (FileFormatI ff : values()) + { + if (ff.isWritable()) + { + l.add(ff.toString()); + } + } + return l; + } + + /** + * Answers a list of readable file formats (as string, corresponding to the + * toString() and forName() methods) + * + * @return + */ + public static List getReadableFormats() + { + List l = new ArrayList(); + for (FileFormatI ff : values()) + { + if (ff.isReadable()) + { + l.add(ff.toString()); + } + } + return l; + } + @Override public boolean isComplexAlignFile() { @@ -527,4 +589,10 @@ public enum FileFormat implements FileFormatI { return extensions; } + + @Override + public String toString() + { + return name; + } }