X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAppletFormatAdapter.java;h=b5ed0521c9f46785e4054e1571d73b2329ef30c6;hb=8b5145f0837eeaeb1f029de179a3715a174dfa09;hp=b1b9e0f63319ac9e53fad0d7ab153cebdbb91b04;hpb=2e8825511b435aa511396c5a2bdcbc600b91340b;p=jalview.git diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index b1b9e0f..b5ed052 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -20,24 +20,24 @@ */ package jalview.io; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Locale; + import jalview.api.AlignExportSettingsI; import jalview.api.AlignmentViewPanel; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; -import jalview.datamodel.SeqDistanceContactMatrix; import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceI; import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; import jalview.util.Platform; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - /** * A low level class for alignment and feature IO with alignment formatting * methods used by both applet and application for generating flat alignment @@ -153,9 +153,17 @@ public class AppletFormatAdapter { return readFile(null, file, sourceType, fileFormat); } - - public AlignmentI readFile(File selectedFile, String file, DataSourceType sourceType, - FileFormatI fileFormat) throws IOException + + public AlignmentI readFile(File selectedFile, String file, + DataSourceType sourceType, FileFormatI fileFormat) + throws IOException + { + return readFile(selectedFile, file, sourceType, fileFormat, null); + } + + public AlignmentI readFile(File selectedFile, String file, + DataSourceType sourceType, FileFormatI fileFormat, + StructureImportSettings.TFType tempfacType) throws IOException { this.selectedFile = selectedFile; @@ -175,10 +183,16 @@ public class AppletFormatAdapter .toString()); StructureImportSettings.addSettings(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct); + if (tempfacType != null) + { + StructureImportSettings.setTemperatureFactorType(tempfacType); + } if (isParseWithJMOL) { // needs a File option - alignFile = new JmolParser(selectedFile == null ? inFile : selectedFile, sourceType); + alignFile = new JmolParser( + selectedFile == null ? inFile : selectedFile, sourceType, + StructureImportSettings.getTemperatureFactorType()); } else { @@ -191,9 +205,12 @@ public class AppletFormatAdapter ((StructureFile) alignFile).setDbRefType( FileFormat.PDB.equals(fileFormat) ? Type.PDB : Type.MMCIF); } - else if (selectedFile != null) { - alignFile = fileFormat.getReader(new FileParse(selectedFile, sourceType)); - } else + else if (selectedFile != null) + { + alignFile = fileFormat + .getReader(new FileParse(selectedFile, sourceType)); + } + else { // alignFile = fileFormat.getAlignmentFile(inFile, sourceType); alignFile = fileFormat.getReader(new FileParse(inFile, sourceType)); @@ -336,8 +353,6 @@ public class AppletFormatAdapter alignFile.addGroups(al); - al.addContactList(new SeqDistanceContactMatrix(al.getWidth())); - return al; } @@ -427,26 +442,26 @@ public class AppletFormatAdapter return null; } - /** * Determines the protocol (i.e DataSourceType.{FILE|PASTE|URL}) for the input * data * * BH 2018 allows File or String, and can return RELATIVE_URL * - * @param dataObject File or String + * @param dataObject + * File or String * @return the protocol for the input data */ public static DataSourceType checkProtocol(Object dataObject) { - if(dataObject instanceof File) + if (dataObject instanceof File) { return DataSourceType.FILE; } - + String data = dataObject.toString(); DataSourceType protocol = DataSourceType.PASTE; - String ft = data.toLowerCase().trim(); + String ft = data.toLowerCase(Locale.ROOT).trim(); if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0 || ft.indexOf("file:") == 0) {