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();
259 ScoreMatrix("Substitution matrix", "", false, false)
262 public AlignmentFileReaderI getReader(FileParse source)
265 return new ScoreMatrixFile(source);
269 public AlignmentFileWriterI getWriter(AlignmentI al)
274 PDB("PDB", "pdb,ent", true, false)
277 public AlignmentFileReaderI getReader(FileParse source)
280 boolean isParseWithJMOL = StructureImportSettings
281 .getDefaultStructureFileFormat() != PDBEntry.Type.PDB;
284 return new JmolParser(source);
288 StructureImportSettings.setShowSeqFeatures(true);
289 return new MCview.PDBfile(
290 StructureImportSettings.isVisibleChainAnnotation(),
291 StructureImportSettings.isProcessSecondaryStructure(),
292 StructureImportSettings.isExternalSecondaryStructure(),
298 public AlignmentFileWriterI getWriter(AlignmentI al)
300 return new JmolParser(); // todo or null?
304 public boolean isStructureFile()
309 MMCif("mmCIF", "cif", true, false)
312 public AlignmentFileReaderI getReader(FileParse source)
315 return new JmolParser(source);
319 public AlignmentFileWriterI getWriter(AlignmentI al)
321 return new JmolParser(); // todo or null?
325 public boolean isStructureFile()
330 Jalview("Jalview", "jar,jvp", true, true)
333 public AlignmentFileReaderI getReader(FileParse source)
340 public AlignmentFileWriterI getWriter(AlignmentI al)
346 public boolean isTextFormat()
352 public boolean isIdentifiable()
358 private boolean writable;
360 private boolean readable;
362 private String extensions;
367 public boolean isComplexAlignFile()
373 public boolean isReadable()
379 public boolean isWritable()
389 * comma-separated list of file extensions associated with the format
393 private FileFormat(String shortName, String extensions,
394 boolean isReadable, boolean isWritable)
396 this.name = shortName;
397 this.extensions = extensions;
398 this.readable = isReadable;
399 this.writable = isWritable;
403 public String getExtensions()
409 * Answers the display name of the file format (as for example shown in menu
410 * options). This name should not be locale (language) dependent.
413 public String getName()
419 public boolean isTextFormat()
425 public boolean isStructureFile()
431 * By default, answers true, indicating the format is one that can be
432 * identified by IdentifyFile. Formats that cannot be identified should
433 * override this method to return false.
435 public boolean isIdentifiable()