*/
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.SequenceI;
import jalview.ext.jmol.JmolParser;
import jalview.structure.StructureImportSettings;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
+import jalview.util.Platform;
/**
* A low level class for alignment and feature IO with alignment formatting
{
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;
- if (selectedFile != null)
- this.inFile = selectedFile.getPath();
- this.inFile = file;
+ this.inFile = selectedFile != null ? selectedFile.getPath() : file;
try
{
if (fileFormat.isStructureFile())
.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
{
- // todo is MCview parsing obsolete yet? JAL-2120
+ // todo is mc_view parsing obsolete yet? JAL-2120
StructureImportSettings.setShowSeqFeatures(true);
- alignFile = new MCview.PDBfile(annotFromStructure,
+ alignFile = new mc_view.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
sourceType);
}
((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));
else
{
StructureImportSettings.setShowSeqFeatures(true);
- alignFile = new MCview.PDBfile(annotFromStructure,
+ alignFile = new mc_view.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
((StructureFile) alignFile).setDbRefType(Type.PDB);
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)
{
protocol = DataSourceType.URL;
}
- else if (jalview.bin.Jalview.isJS())
+ else if (Platform.isJS())
{
protocol = DataSourceType.RELATIVE_URL;
}
return protocol;
}
+ /**
+ * @param args
+ * @j2sIgnore
+ */
public static void main(String[] args)
{
int i = 0;