X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAppletFormatAdapter.java;h=fb414f41ff1d143dcf8ee74967b70543a275bb3d;hb=d8b9b83f2739ee2c11670af890d2c63b8c1c2b7c;hp=e34093dc836fcf6e2b7de7dbb14bb7f21b982411;hpb=26ba864a6c290121fe6cf616794d2d0bea65fb7d;p=jalview.git diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index e34093d..fb414f4 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -26,6 +26,7 @@ import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; +import jalview.structure.StructureImportSettings; import jalview.util.MessageManager; import java.io.File; @@ -86,7 +87,7 @@ public class AppletFormatAdapter public static final String[] READABLE_FORMATS = new String[] { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, - IdentifyFile.FeaturesFile, "HTML" }; + IdentifyFile.FeaturesFile, "HTML", "mmCIF" }; /** * List of readable format file extensions by application in order @@ -95,7 +96,7 @@ public class AppletFormatAdapter public static final String[] READABLE_EXTENSIONS = new String[] { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, JSONFile.FILE_EXT, - ".gff2,gff3", "jar,jvp", HtmlFile.FILE_EXT }; + ".gff2,gff3", "jar,jvp", HtmlFile.FILE_EXT, "cif" }; /** * List of readable formats by application in order corresponding to @@ -104,7 +105,7 @@ public class AppletFormatAdapter public static final String[] READABLE_FNAMES = new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, IdentifyFile.FeaturesFile, - "Jalview", HtmlFile.FILE_DESC }; + "Jalview", HtmlFile.FILE_DESC, "mmCIF" }; /** * List of valid format strings for use by callers of the formatSequences @@ -277,10 +278,34 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - alignFile = new MCview.PDBfile(annotFromStructure, + // TODO obtain config value from preference settings. + // Set value to 'true' to test PDB processing with Jmol: JAL-1213 + boolean isParseWithJMOL = !StructureImportSettings + .getCurrentDefaultFormat().equalsIgnoreCase("PDB"); + if (isParseWithJMOL) + { + StructureImportSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); + alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, inFile, + type); + } + else + { + StructureImportSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); + StructureImportSettings.setShowSeqFeatures(true); + alignFile = new MCview.PDBfile(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, inFile, + type); + } + } + else if (format.equals("mmCIF")) + { + StructureImportSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); + alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, inFile, type); - // Uncomment to test Jmol data based PDB processing: JAL-1213 - // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type); } else if (format.equals("STH")) { @@ -407,7 +432,27 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - alignFile = new MCview.PDBfile(annotFromStructure, + // TODO obtain config value from preference settings + boolean isParseWithJMOL = false; + if (isParseWithJMOL) + { + StructureImportSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); + alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, source); + } + else + { + StructureImportSettings.setShowSeqFeatures(true); + alignFile = new MCview.PDBfile(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct, source); + } + } + else if (format.equals("mmCIF")) + { + StructureImportSettings.addSettings(annotFromStructure, + localSecondaryStruct, serviceSecondaryStruct); + alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, source); } else if (format.equals("STH")) @@ -428,8 +473,7 @@ public class AppletFormatAdapter } else if (format.equals(IdentifyFile.FeaturesFile)) { - // enforce 'parseImmediately' here: - alignFile = new FeaturesFile(true, inFile, type); + alignFile = new FeaturesFile(inFile, type); } else if (format.equals(JSONFile.FILE_DESC)) {