3 import jalview.datamodel.AlignmentI;
4 import jalview.datamodel.PDBEntry;
5 import jalview.ext.jmol.JmolParser;
6 import jalview.structure.StructureImportSettings;
8 import java.io.IOException;
10 public enum FileFormat implements FileFormatI
12 Fasta("Fasta", "fa, fasta, mfa, fastq", true, true)
15 public AlignmentFileReaderI getReader(FileParse source)
18 return new FastaFile(source);
22 public AlignmentFileWriterI getWriter(AlignmentI al)
24 return new FastaFile();
27 Pfam("PFAM", "pfam", true, true)
30 public AlignmentFileReaderI getReader(FileParse source)
33 return new PfamFile(source);
37 public AlignmentFileWriterI getWriter(AlignmentI al)
39 return new PfamFile();
42 Stockholm("Stockholm", "sto,stk", true, true)
45 public AlignmentFileReaderI getReader(FileParse source)
48 return new StockholmFile(source);
52 public AlignmentFileWriterI getWriter(AlignmentI al)
54 return new StockholmFile(al);
59 PIR("PIR", "pir", true, true)
62 public AlignmentFileReaderI getReader(FileParse source)
65 return new PIRFile(source);
69 public AlignmentFileWriterI getWriter(AlignmentI al)
74 BLC("BLC", "BLC", true, true)
77 public AlignmentFileReaderI getReader(FileParse source)
80 return new BLCFile(source);
84 public AlignmentFileWriterI getWriter(AlignmentI al)
89 AMSA("AMSA", "amsa", true, true)
92 public AlignmentFileReaderI getReader(FileParse source)
95 return new AMSAFile(source);
99 public AlignmentFileWriterI getWriter(AlignmentI al)
101 return new AMSAFile(al);
104 Html("HTML", "html", true, false)
107 public AlignmentFileReaderI getReader(FileParse source)
110 return new HtmlFile(source);
114 public AlignmentFileWriterI getWriter(AlignmentI al)
116 return new HtmlFile();
120 public boolean isComplexAlignFile()
126 Rnaml("RNAML", "xml,rnaml", true, false)
129 public AlignmentFileReaderI getReader(FileParse source)
132 return new RnamlFile(source);
136 public AlignmentFileWriterI getWriter(AlignmentI al)
138 return new RnamlFile();
142 Json("JSON", "json", true, true)
145 public AlignmentFileReaderI getReader(FileParse source)
148 return new JSONFile(source);
152 public AlignmentFileWriterI getWriter(AlignmentI al)
154 return new JSONFile();
158 public boolean isComplexAlignFile()
164 Pileup("PileUp", "pileup", true, true)
167 public AlignmentFileReaderI getReader(FileParse source)
170 return new PileUpfile(source);
174 public AlignmentFileWriterI getWriter(AlignmentI al)
176 return new PileUpfile();
180 MSF("MSF", "msf", true, true)
183 public AlignmentFileReaderI getReader(FileParse source)
186 return new MSFfile(source);
190 public AlignmentFileWriterI getWriter(AlignmentI al)
192 return new MSFfile();
196 Clustal("Clustal", "aln", true, true)
199 public AlignmentFileReaderI getReader(FileParse source)
202 return new ClustalFile(source);
206 public AlignmentFileWriterI getWriter(AlignmentI al)
208 return new ClustalFile();
211 Phylip("PHYLIP", "phy", true, true)
214 public AlignmentFileReaderI getReader(FileParse source)
217 return new PhylipFile(source);
221 public AlignmentFileWriterI getWriter(AlignmentI al)
223 return new PhylipFile();
226 Jnet("JnetFile", "", false, false)
229 public AlignmentFileReaderI getReader(FileParse source)
232 JPredFile af = new JPredFile(source);
233 af.removeNonSequences();
238 public AlignmentFileWriterI getWriter(AlignmentI al)
240 return null; // todo is this called?
244 Features("GFF or Jalview features", "gff2,gff3", true, false)
247 public AlignmentFileReaderI getReader(FileParse source)
250 return new FeaturesFile(source);
254 public AlignmentFileWriterI getWriter(AlignmentI al)
256 return new FeaturesFile();
260 public boolean hasSequenceData()
265 ScoreMatrix("Substitution matrix", "", false, false)
268 public AlignmentFileReaderI getReader(FileParse source)
271 return new ScoreMatrixFile(source);
275 public AlignmentFileWriterI getWriter(AlignmentI al)
281 public boolean hasSequenceData()
286 PDB("PDB", "pdb,ent", true, false)
289 public AlignmentFileReaderI getReader(FileParse source)
292 boolean isParseWithJMOL = StructureImportSettings
293 .getDefaultStructureFileFormat() != PDBEntry.Type.PDB;
296 return new JmolParser(source);
300 StructureImportSettings.setShowSeqFeatures(true);
301 return new MCview.PDBfile(
302 StructureImportSettings.isVisibleChainAnnotation(),
303 StructureImportSettings.isProcessSecondaryStructure(),
304 StructureImportSettings.isExternalSecondaryStructure(),
310 public AlignmentFileWriterI getWriter(AlignmentI al)
312 return new JmolParser(); // todo or null?
316 public boolean isStructureFile()
321 MMCif("mmCIF", "cif", true, false)
324 public AlignmentFileReaderI getReader(FileParse source)
327 return new JmolParser(source);
331 public AlignmentFileWriterI getWriter(AlignmentI al)
333 return new JmolParser(); // todo or null?
337 public boolean isStructureFile()
342 Jalview("Jalview", "jar,jvp", true, true)
345 public AlignmentFileReaderI getReader(FileParse source)
352 public AlignmentFileWriterI getWriter(AlignmentI al)
358 public boolean isTextFormat()
364 public boolean isIdentifiable()
370 private boolean writable;
372 private boolean readable;
374 private String extensions;
379 public boolean isComplexAlignFile()
385 public boolean isReadable()
391 public boolean isWritable()
401 * comma-separated list of file extensions associated with the format
405 private FileFormat(String shortName, String extensions,
406 boolean isReadable, boolean isWritable)
408 this.name = shortName;
409 this.extensions = extensions;
410 this.readable = isReadable;
411 this.writable = isWritable;
415 public String getExtensions()
421 * Answers the display name of the file format (as for example shown in menu
422 * options). This name should not be locale (language) dependent.
425 public String getName()
431 public boolean isTextFormat()
437 public boolean isStructureFile()
443 * By default, answers true, indicating the format is one that can be
444 * identified by IdentifyFile. Formats that cannot be identified should
445 * override this method to return false.
447 public boolean isIdentifiable()
453 public boolean hasSequenceData()