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 PDB("PDB", "pdb,ent", true, false)
262 public AlignmentFileReaderI getReader(FileParse source)
265 boolean isParseWithJMOL = StructureImportSettings
266 .getDefaultStructureFileFormat() != PDBEntry.Type.PDB;
269 return new JmolParser(source);
273 StructureImportSettings.setShowSeqFeatures(true);
274 return new MCview.PDBfile(
275 StructureImportSettings.isVisibleChainAnnotation(),
276 StructureImportSettings.isProcessSecondaryStructure(),
277 StructureImportSettings.isExternalSecondaryStructure(),
283 public AlignmentFileWriterI getWriter(AlignmentI al)
285 return new JmolParser(); // todo or null?
289 public boolean isStructureFile()
294 MMCif("mmCIF", "cif", true, false)
297 public AlignmentFileReaderI getReader(FileParse source)
300 return new JmolParser(source);
304 public AlignmentFileWriterI getWriter(AlignmentI al)
306 return new JmolParser(); // todo or null?
310 public boolean isStructureFile()
315 Jalview("Jalview", "jar,jvp", true, true)
318 public AlignmentFileReaderI getReader(FileParse source)
325 public AlignmentFileWriterI getWriter(AlignmentI al)
331 public boolean isTextFormat()
337 private boolean writable;
339 private boolean readable;
341 private String extensions;
346 public boolean isComplexAlignFile()
352 public boolean isReadable()
358 public boolean isWritable()
368 * comma-separated list of file extensions associated with the format
372 private FileFormat(String shortName, String extensions,
373 boolean isReadable, boolean isWritable)
375 this.name = shortName;
376 this.extensions = extensions;
377 this.readable = isReadable;
378 this.writable = isWritable;
382 public String getExtensions()
388 * Answers the display name of the file format (as for example shown in menu
389 * options). This name should not be locale (language) dependent.
392 public String getName()
398 public boolean isTextFormat()
404 public boolean isStructureFile()