JAL-629 refactoring TFType. Remove i18n identification of annotation.
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 11 Jan 2023 11:55:14 +0000 (11:55 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 11 Jan 2023 11:55:14 +0000 (11:55 +0000)
12 files changed:
src/jalview/bin/Commands.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/datamodel/annotations/AlphaFoldAnnotationRowBuilder.java
src/jalview/datamodel/annotations/AnnotationRowBuilder.java
src/jalview/ext/jmol/JmolParser.java
src/jalview/io/AlignFile.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/FileLoader.java
src/jalview/io/FormatAdapter.java
src/jalview/io/StructureFile.java
src/jalview/structure/StructureImportSettings.java
src/jalview/ws/dbsources/EBIAlfaFold.java

index 2a71e74..c08dd23 100644 (file)
@@ -16,7 +16,9 @@ import jalview.bin.ArgParser.Arg;
 import jalview.bin.ArgParser.ArgValues;
 import jalview.bin.ArgParser.SubVal;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.bin.ArgParser.ArgValues;
 import jalview.bin.ArgParser.SubVal;
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.SequenceI;
+import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder;
 import jalview.gui.AlignFrame;
 import jalview.gui.AlignmentPanel;
 import jalview.gui.Desktop;
 import jalview.gui.AlignFrame;
 import jalview.gui.AlignmentPanel;
 import jalview.gui.Desktop;
@@ -28,6 +30,8 @@ import jalview.io.FileFormatI;
 import jalview.io.FileLoader;
 import jalview.io.HtmlSvgOutput;
 import jalview.io.IdentifyFile;
 import jalview.io.FileLoader;
 import jalview.io.HtmlSvgOutput;
 import jalview.io.IdentifyFile;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 import jalview.util.HttpUtils;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.util.HttpUtils;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
@@ -187,13 +191,13 @@ public class Commands
            */
 
           // get kind of temperature factor annotation
            */
 
           // get kind of temperature factor annotation
-          AlignmentAnnotation.TFType tempfacType = null;
+          StructureImportSettings.TFType tempfacType = TFType.DEFAULT;
           if ((!ArgParser.getBoolean(m, Arg.NOTEMPFAC))
                   && ArgParser.getArgValues(m, Arg.TEMPFAC) != null)
           {
             try
             {
           if ((!ArgParser.getBoolean(m, Arg.NOTEMPFAC))
                   && ArgParser.getArgValues(m, Arg.TEMPFAC) != null)
           {
             try
             {
-              tempfacType = AlignmentAnnotation.TFType.valueOf(ArgParser
+              tempfacType = StructureImportSettings.TFType.valueOf(ArgParser
                       .getValue(m, Arg.TEMPFAC).toUpperCase(Locale.ROOT));
               Console.debug("Obtained Temperature Factor type of '"
                       + tempfacType + "'");
                       .getValue(m, Arg.TEMPFAC).toUpperCase(Locale.ROOT));
               Console.debug("Obtained Temperature Factor type of '"
                       + tempfacType + "'");
@@ -204,8 +208,8 @@ public class Commands
                       .append(Arg.TEMPFAC.getName()).append(" to '")
                       .append(tempfacType)
                       .append("', ignoring.  Valid values are: ");
                       .append(Arg.TEMPFAC.getName()).append(" to '")
                       .append(tempfacType)
                       .append("', ignoring.  Valid values are: ");
-              Iterator<AlignmentAnnotation.TFType> it = Arrays
-                      .stream(AlignmentAnnotation.TFType.values())
+              Iterator<StructureImportSettings.TFType> it = Arrays
+                      .stream(StructureImportSettings.TFType.values())
                       .iterator();
               while (it.hasNext())
               {
                       .iterator();
               while (it.hasNext())
               {
@@ -220,8 +224,11 @@ public class Commands
           Console.debug(
                   "Opening '" + openFile + "' in new alignment frame");
           FileLoader fileLoader = new FileLoader(!headless);
           Console.debug(
                   "Opening '" + openFile + "' in new alignment frame");
           FileLoader fileLoader = new FileLoader(!headless);
-          af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format,
-                  tempfacType);
+
+          StructureImportSettings.setTemperatureFactorType(tempfacType);
+
+          af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
+                  format);
 
           // wrap alignment?
           if (ArgParser.getBoolean(m, Arg.WRAP))
 
           // wrap alignment?
           if (ArgParser.getBoolean(m, Arg.WRAP))
@@ -250,8 +257,7 @@ public class Commands
             // do this better (annotation types?)
             List<String> hideThese = new ArrayList<>();
             hideThese.add("Temperature Factor");
             // do this better (annotation types?)
             List<String> hideThese = new ArrayList<>();
             hideThese.add("Temperature Factor");
-            hideThese.add(MessageManager
-                    .getString("label.alphafold_reliability"));
+            hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
             AlignmentUtils.showOrHideSequenceAnnotations(
                     af.getCurrentView().getAlignment(), hideThese, null,
                     false, false);
             AlignmentUtils.showOrHideSequenceAnnotations(
                     af.getCurrentView().getAlignment(), hideThese, null,
                     false, false);
@@ -322,11 +328,20 @@ public class Commands
         {
           SubVal subVal = ArgParser.getSubVal(val);
           File paeFile = new File(subVal.content);
         {
           SubVal subVal = ArgParser.getSubVal(val);
           File paeFile = new File(subVal.content);
-          EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
-                  paeFile, subVal.index,
-                  "id".equals(subVal.keyName) ? subVal.keyValue : null);
-          // required to readjust the height and position of the pAE
-          // annotation
+          if ("structid".equals(subVal.index))
+          {
+            EBIAlfaFold.addAlphaFoldPAEToStructure(
+                    af.getCurrentView().getAlignment(), paeFile,
+                    subVal.index, subVal.keyValue);
+          }
+          else
+          {
+            EBIAlfaFold.addAlphaFoldPAEToSequence(af.getCurrentView().getAlignment(),
+                    paeFile, subVal.index,
+                    "id".equals(subVal.keyName) ? subVal.keyValue : null);
+            // required to readjust the height and position of the pAE
+            // annotation
+          }
           for (AlignmentViewPanel ap : af.getAlignPanels())
           {
             ap.adjustAnnotationHeight();
           for (AlignmentViewPanel ap : af.getAlignPanels())
           {
             ap.adjustAnnotationHeight();
@@ -429,15 +444,21 @@ public class Commands
         switch (type)
         {
         case "svg":
         switch (type)
         {
         case "svg":
+          Console.debug("Outputting type '" + type + "' to " + fileName);
           af.createSVG(file);
           break;
         case "png":
           af.createSVG(file);
           break;
         case "png":
+          Console.debug("Outputting type '" + type + "' to " + fileName);
           af.createPNG(file);
           break;
         case "html":
           af.createPNG(file);
           break;
         case "html":
+          Console.debug("Outputting type '" + type + "' to " + fileName);
           HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
           htmlSVG.exportHTML(fileName);
           break;
           HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
           htmlSVG.exportHTML(fileName);
           break;
+        default:
+          Console.warn("--image type '" + type + "' not known. Ignoring");
+          break;
         }
       }
     }
         }
       }
     }
@@ -445,24 +466,15 @@ public class Commands
 
   private SequenceI getSpecifiedSequence(AlignFrame af, SubVal subId)
   {
 
   private SequenceI getSpecifiedSequence(AlignFrame af, SubVal subId)
   {
-    SequenceI seq = null;
-    SequenceI[] sequences = af.getCurrentView().getAlignment()
-            .getSequencesArray();
-    if (-1 < subId.index && subId.index < sequences.length)
+    AlignmentI al = af.getCurrentView().getAlignment();
+    if (-1 < subId.index && subId.index < al.getSequences().size())
     {
     {
-      seq = sequences[subId.index];
+      return al.getSequenceAt(subId.index);
     }
     else if ("id".equals(subId.keyName))
     {
     }
     else if ("id".equals(subId.keyName))
     {
-      for (SequenceI s : sequences)
-      {
-        if (s.getDisplayId(false).equals(subId.keyValue))
-        {
-          seq = s;
-          break;
-        }
-      }
+      return al.findName(subId.keyValue);
     }
     }
-    return seq;
+    return null;
   }
 }
   }
 }
index 636088b..3f9c2d9 100755 (executable)
@@ -34,6 +34,7 @@ import java.util.Map.Entry;
 import jalview.analysis.Rna;
 import jalview.analysis.SecStrConsensus.SimpleBP;
 import jalview.analysis.WUSSParseException;
 import jalview.analysis.Rna;
 import jalview.analysis.SecStrConsensus.SimpleBP;
 import jalview.analysis.WUSSParseException;
+import jalview.structure.StructureImportSettings;
 
 /**
  * DOCUMENT ME!
 
 /**
  * DOCUMENT ME!
@@ -96,22 +97,17 @@ public class AlignmentAnnotation
    */
   private long invalidrnastruc = -2;
 
    */
   private long invalidrnastruc = -2;
 
-  public static enum TFType
-  {
-    DEFAULT, PLDDT, DOSE;
-  }
-
   /**
    * the type of temperature factor plot (if it is one)
    */
   /**
    * the type of temperature factor plot (if it is one)
    */
-  private TFType tfType = TFType.DEFAULT;
+  private StructureImportSettings.TFType tfType = StructureImportSettings.TFType.DEFAULT;
 
 
-  public void setTFType(TFType t)
+  public void setTFType(StructureImportSettings.TFType t)
   {
     tfType = t;
   }
 
   {
     tfType = t;
   }
 
-  public TFType getTFType()
+  public StructureImportSettings.TFType getTFType()
   {
     return tfType;
   }
   {
     return tfType;
   }
index fa48968..4e9553e 100644 (file)
@@ -1,18 +1,20 @@
 package jalview.datamodel.annotations;
 
 package jalview.datamodel.annotations;
 
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.Annotation;
-import jalview.util.MessageManager;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 
 public class AlphaFoldAnnotationRowBuilder extends AnnotationRowBuilder
 {
 
 public class AlphaFoldAnnotationRowBuilder extends AnnotationRowBuilder
 {
+  public static final String LABEL = "Alphafold Reliability";
+
   public AlphaFoldAnnotationRowBuilder()
   {
   public AlphaFoldAnnotationRowBuilder()
   {
-    super(MessageManager.getString("label.alphafold_reliability"));
+    super(LABEL);
     min = 0;
     max = 100;
     hasMinMax = true;
     min = 0;
     max = 100;
     hasMinMax = true;
-    this.setTFType(TFType.PLDDT);
+    this.setTFType(StructureImportSettings.TFType.PLDDT);
   }
 
   @Override
   }
 
   @Override
index 573b1a9..b3d567a 100644 (file)
@@ -1,7 +1,8 @@
 package jalview.datamodel.annotations;
 
 package jalview.datamodel.annotations;
 
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.Annotation;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 
 public class AnnotationRowBuilder
 {
 
 public class AnnotationRowBuilder
 {
@@ -17,14 +18,14 @@ public class AnnotationRowBuilder
   /**
    * the type of temperature factor plot (if it is one)
    */
   /**
    * the type of temperature factor plot (if it is one)
    */
-  private TFType tfType = TFType.DEFAULT;
+  private StructureImportSettings.TFType tfType = StructureImportSettings.TFType.DEFAULT;
 
 
-  public void setTFType(TFType t)
+  public void setTFType(StructureImportSettings.TFType t)
   {
     tfType = t;
   }
 
   {
     tfType = t;
   }
 
-  public TFType getTFType()
+  public StructureImportSettings.TFType getTFType()
   {
     return tfType;
   }
   {
     return tfType;
   }
@@ -96,7 +97,7 @@ public class AnnotationRowBuilder
     name = string;
   }
 
     name = string;
   }
 
-  public AnnotationRowBuilder(String name, float min, float max, TFType tft)
+  public AnnotationRowBuilder(String name, float min, float max, StructureImportSettings.TFType tft)
   {
     this(name, min, max);
     setTFType(tft);
   {
     this(name, min, max);
     setTFType(tft);
index 9306388..37b3d68 100644 (file)
@@ -40,7 +40,6 @@ import com.stevesoft.pat.Regex;
 import jalview.bin.Console;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.bin.Console;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
@@ -50,6 +49,7 @@ import jalview.io.DataSourceType;
 import jalview.io.FileParse;
 import jalview.io.StructureFile;
 import jalview.schemes.ResidueProperties;
 import jalview.io.FileParse;
 import jalview.io.StructureFile;
 import jalview.schemes.ResidueProperties;
+import jalview.structure.StructureImportSettings;
 import jalview.util.Format;
 import jalview.util.MessageManager;
 import jalview.ws.dbsources.EBIAlfaFold;
 import jalview.util.Format;
 import jalview.util.MessageManager;
 import jalview.ws.dbsources.EBIAlfaFold;
@@ -84,7 +84,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener
   }
 
   public JmolParser(Object inFile, DataSourceType sourceType,
   }
 
   public JmolParser(Object inFile, DataSourceType sourceType,
-          AlignmentAnnotation.TFType tempfacType) throws IOException
+          StructureImportSettings.TFType tempfacType) throws IOException
   {
     super(inFile, sourceType, tempfacType);
   }
   {
     super(inFile, sourceType, tempfacType);
   }
@@ -251,8 +251,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener
         {
           AnnotationRowBuilder builder = null;
           String tempFString = null;
         {
           AnnotationRowBuilder builder = null;
           String tempFString = null;
-          if (isAlphafoldModel()
-                  || this.getTemperatureFactorType() == AlignmentAnnotation.TFType.PLDDT)
+          if (isAlphafoldModel() || this
+                  .getTemperatureFactorType() == StructureImportSettings.TFType.PLDDT)
           {
             builder = new AlphaFoldAnnotationRowBuilder();
           }
           {
             builder = new AlphaFoldAnnotationRowBuilder();
           }
@@ -321,6 +321,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener
     }
   }
 
     }
   }
 
+  public void setAlphafoldModel(boolean afm)
+  {
+    alphaFoldModel = afm;
+  }
+
   private boolean isAlphafoldModel()
   {
     return alphaFoldModel;
   private boolean isAlphafoldModel()
   {
     return alphaFoldModel;
index 889d72e..3202ac9 100755 (executable)
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Vector;
 
 import jalview.datamodel.AlignmentAnnotation;
 import java.util.Vector;
 
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
@@ -82,13 +81,6 @@ public abstract class AlignFile extends FileParse
 
   private boolean dataClosed = false;
 
 
   private boolean dataClosed = false;
 
-  private AlignmentAnnotation.TFType temperatureFactorType = null;
-
-  public AlignmentAnnotation.TFType getTemperatureFactorType()
-  {
-    return this.temperatureFactorType;
-  }
-
   /**
    * @return if doParse() was called at construction time
    */
   /**
    * @return if doParse() was called at construction time
    */
@@ -125,13 +117,7 @@ public abstract class AlignFile extends FileParse
   public AlignFile(Object dataObject, DataSourceType sourceType)
           throws IOException
   {
   public AlignFile(Object dataObject, DataSourceType sourceType)
           throws IOException
   {
-    this(dataObject, sourceType, null);
-  }
-
-  public AlignFile(Object dataObject, DataSourceType sourceType,
-          AlignmentAnnotation.TFType tempfacType) throws IOException
-  {
-    this(true, dataObject, sourceType, tempfacType);
+    this(true, dataObject, sourceType);
   }
 
   /**
   }
 
   /**
@@ -149,16 +135,9 @@ public abstract class AlignFile extends FileParse
   public AlignFile(boolean parseImmediately, Object dataObject,
           DataSourceType sourceType) throws IOException
   {
   public AlignFile(boolean parseImmediately, Object dataObject,
           DataSourceType sourceType) throws IOException
   {
-    this(parseImmediately, dataObject, sourceType, null);
-  }
-
-  public AlignFile(boolean parseImmediately, Object dataObject,
-          DataSourceType sourceType, AlignmentAnnotation.TFType tempfacType) throws IOException
-  {
     // BH allows File or String
     super(dataObject, sourceType);
     initData();
     // BH allows File or String
     super(dataObject, sourceType);
     initData();
-    this.temperatureFactorType = tempfacType;
     if (parseImmediately)
     {
       doParse();
     if (parseImmediately)
     {
       doParse();
index 8b1525c..60eb9cc 100755 (executable)
@@ -30,13 +30,13 @@ import jalview.api.AlignExportSettingsI;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.PDBEntry.Type;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JmolParser;
 import jalview.structure.StructureImportSettings;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.PDBEntry.Type;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JmolParser;
 import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 import jalview.util.Platform;
 
 /**
 import jalview.util.Platform;
 
 /**
@@ -164,7 +164,7 @@ public class AppletFormatAdapter
 
   public AlignmentI readFile(File selectedFile, String file,
           DataSourceType sourceType, FileFormatI fileFormat,
 
   public AlignmentI readFile(File selectedFile, String file,
           DataSourceType sourceType, FileFormatI fileFormat,
-          AlignmentAnnotation.TFType tempfacType) throws IOException
+          StructureImportSettings.TFType tempfacType) throws IOException
   {
 
     this.selectedFile = selectedFile;
   {
 
     this.selectedFile = selectedFile;
index c7ade20..d3ac53f 100755 (executable)
@@ -33,8 +33,6 @@ import jalview.api.FeaturesDisplayedI;
 import jalview.api.FeaturesSourceI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
 import jalview.api.FeaturesSourceI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
@@ -75,8 +73,6 @@ public class FileLoader implements Runnable
 
   private File selectedFile;
 
 
   private File selectedFile;
 
-  private AlignmentAnnotation.TFType temperatureFactorType = null;
-
   /**
    * default constructor always raised errors in GUI dialog boxes
    */
   /**
    * default constructor always raised errors in GUI dialog boxes
    */
@@ -162,26 +158,9 @@ public class FileLoader implements Runnable
   public AlignFrame LoadFileWaitTillLoaded(String file,
           DataSourceType sourceType, FileFormatI format)
   {
   public AlignFrame LoadFileWaitTillLoaded(String file,
           DataSourceType sourceType, FileFormatI format)
   {
-    return LoadFileWaitTillLoaded(file, sourceType, format, null);
-  }
-
-  /**
-   * Load alignment from (file, protocol) of type format with specified
-   * temperature factor type and wait till loaded
-   * 
-   * @param file
-   * @param sourceType
-   * @param format
-   * @param tempfacType
-   * @return alignFrame constructed from file contents
-   */
-  public AlignFrame LoadFileWaitTillLoaded(String file,
-          DataSourceType sourceType, FileFormatI format, AlignmentAnnotation.TFType tempfacType)
-  {
     this.file = file;
     this.protocol = sourceType;
     this.format = format;
     this.file = file;
     this.protocol = sourceType;
     this.format = format;
-    this.temperatureFactorType = tempfacType;
     return _LoadFileWaitTillLoaded();
   }
 
     return _LoadFileWaitTillLoaded();
   }
 
@@ -400,14 +379,12 @@ public class FileLoader implements Runnable
             {
               if (selectedFile == null)
               {
             {
               if (selectedFile == null)
               {
-                al = fa.readFile(null, file, protocol, format,
-                        temperatureFactorType);
+                al = fa.readFile(null, file, protocol, format);
 
               }
               else
               {
 
               }
               else
               {
-                al = fa.readFile(selectedFile, null, protocol, format,
-                        temperatureFactorType);
+                al = fa.readFile(selectedFile, null, protocol, format);
               }
               source = fa.getAlignFile(); // keep reference for later if
 
               }
               source = fa.getAlignFile(); // keep reference for later if
 
index 0ca2b50..d6e6767 100755 (executable)
@@ -29,12 +29,13 @@ import jalview.api.AlignmentViewPanel;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
+import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 import jalview.util.Comparison;
 
 /**
 import jalview.util.Comparison;
 
 /**
@@ -230,7 +231,7 @@ public class FormatAdapter extends AppletFormatAdapter
   @Override
   public AlignmentI readFile(File selectedFile, String file,
           DataSourceType sourceType, FileFormatI fileFormat,
   @Override
   public AlignmentI readFile(File selectedFile, String file,
           DataSourceType sourceType, FileFormatI fileFormat,
-          AlignmentAnnotation.TFType tempfacType) throws IOException
+          StructureImportSettings.TFType tempfacType) throws IOException
   {
     AlignmentI al = super.readFile(selectedFile, file, sourceType,
             fileFormat, tempfacType);
   {
     AlignmentI al = super.readFile(selectedFile, file, sourceType,
             fileFormat, tempfacType);
index c816f6d..7ecbc2d 100644 (file)
@@ -30,7 +30,6 @@ import jalview.analysis.AlignSeq;
 import jalview.api.FeatureSettingsModelI;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.api.FeatureSettingsModelI;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.DBRefSource;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.DBRefSource;
@@ -38,6 +37,7 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.PDBEntry.Type;
 import jalview.datamodel.SequenceI;
 import jalview.structure.StructureImportSettings;
 import jalview.datamodel.PDBEntry.Type;
 import jalview.datamodel.SequenceI;
 import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.TFType;
 import mc_view.PDBChain;
 
 public abstract class StructureFile extends AlignFile
 import mc_view.PDBChain;
 
 public abstract class StructureFile extends AlignFile
@@ -68,6 +68,18 @@ public abstract class StructureFile extends AlignFile
 
   private boolean pdbIdAvailable;
 
 
   private boolean pdbIdAvailable;
 
+  private StructureImportSettings.TFType temperatureFactorType = TFType.DEFAULT;
+
+  public void setTemperatureFactorType(StructureImportSettings.TFType t)
+  {
+    this.temperatureFactorType = t;
+  }
+
+  public StructureImportSettings.TFType getTemperatureFactorType()
+  {
+    return temperatureFactorType;
+  }
+
   public StructureFile(Object inFile, DataSourceType sourceType)
           throws IOException
   {
   public StructureFile(Object inFile, DataSourceType sourceType)
           throws IOException
   {
@@ -75,9 +87,10 @@ public abstract class StructureFile extends AlignFile
   }
 
   public StructureFile(Object inFile, DataSourceType sourceType,
   }
 
   public StructureFile(Object inFile, DataSourceType sourceType,
-          AlignmentAnnotation.TFType tempfacType) throws IOException
+          StructureImportSettings.TFType tempfacType) throws IOException
   {
   {
-    super(inFile, sourceType, tempfacType);
+    super(inFile, sourceType);
+    this.setTemperatureFactorType(tempfacType);
   }
 
   public StructureFile(FileParse fp) throws IOException
   }
 
   public StructureFile(FileParse fp) throws IOException
@@ -101,7 +114,8 @@ public abstract class StructureFile extends AlignFile
             .isProcessSecondaryStructure();
     this.externalSecondaryStructure = StructureImportSettings
             .isExternalSecondaryStructure();
             .isProcessSecondaryStructure();
     this.externalSecondaryStructure = StructureImportSettings
             .isExternalSecondaryStructure();
-
+    this.temperatureFactorType = StructureImportSettings
+            .getTemperatureFactorType();
   }
 
   public StructureFile(boolean parseImmediately, Object dataObject,
   }
 
   public StructureFile(boolean parseImmediately, Object dataObject,
index cbd59b1..597338e 100644 (file)
@@ -59,6 +59,11 @@ public class StructureImportSettings
     JMOL_PARSER, JALVIEW_PARSER
   }
 
     JMOL_PARSER, JALVIEW_PARSER
   }
 
+  public static enum TFType
+  {
+    DEFAULT, PLDDT, DOSE;
+  }
+
   /**
    * Determines the default file format for structure files to be downloaded
    * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
   /**
    * Determines the default file format for structure files to be downloaded
    * from the PDB sequence fetcher. Possible options include: PDB|mmCIF
@@ -71,6 +76,8 @@ public class StructureImportSettings
    */
   private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
 
    */
   private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
 
+  private static TFType temperatureFactorType;
+
   public static void addSettings(boolean addAlignmentAnnotations,
           boolean processSecStr, boolean externalSecStr)
   {
   public static void addSettings(boolean addAlignmentAnnotations,
           boolean processSecStr, boolean externalSecStr)
   {
@@ -85,6 +92,11 @@ public class StructureImportSettings
     return visibleChainAnnotation;
   }
 
     return visibleChainAnnotation;
   }
 
+  public static void setTemperatureFactorType(TFType t)
+  {
+    StructureImportSettings.temperatureFactorType = t;
+  }
+
   public static void setVisibleChainAnnotation(
           boolean visibleChainAnnotation)
   {
   public static void setVisibleChainAnnotation(
           boolean visibleChainAnnotation)
   {
@@ -152,4 +164,9 @@ public class StructureImportSettings
             .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));
   }
 
             .valueOf(defaultPDBFileParser.toUpperCase(Locale.ROOT));
   }
 
+  public static TFType getTemperatureFactorType()
+  {
+    return temperatureFactorType;
+  }
+
 }
 }
index 5575cb8..859ac05 100644 (file)
@@ -43,11 +43,13 @@ import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.gui.Desktop;
 import jalview.io.DataSourceType;
 import jalview.io.FileFormat;
 import jalview.io.FileFormatI;
 import jalview.io.FormatAdapter;
 import jalview.io.PDBFeatureSettings;
 import jalview.io.DataSourceType;
 import jalview.io.FileFormat;
 import jalview.io.FileFormatI;
 import jalview.io.FormatAdapter;
 import jalview.io.PDBFeatureSettings;
+import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.ws.datamodel.alphafold.PAEContactMatrix;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.ws.datamodel.alphafold.PAEContactMatrix;
@@ -249,11 +251,11 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
     Console.debug("Downloading pae from " + paeURL + " to " + pae.toString()
             + "");
     UrlDownloadClient.download(paeURL, pae);
     Console.debug("Downloading pae from " + paeURL + " to " + pae.toString()
             + "");
     UrlDownloadClient.download(paeURL, pae);
-    addAlphaFoldPAE(pdbAlignment, pae, 0, null);
+    addAlphaFoldPAEToSequence(pdbAlignment, pae, 0, null);
   }
 
   }
 
-  public static void addAlphaFoldPAE(AlignmentI pdbAlignment, File pae,
-          int index, String seqId)
+  public static void addAlphaFoldPAEToSequence(AlignmentI pdbAlignment,
+          File pae, int index, String seqId)
   {
     FileInputStream pae_input = null;
     try
   {
     FileInputStream pae_input = null;
     try
@@ -286,6 +288,21 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
 
   }
 
 
   }
 
+  public static void addAlphaFoldPAEToStructure(AlignmentI pdbAlignment,
+          File pae, int index, String structId)
+  {
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(Desktop.instance);
+    if (ssm != null)
+    {
+      /*
+      ssm.setAddTempFacAnnot(showTemperatureFactor);
+      ssm.setProcessSecondaryStructure(showSecondaryStructure);
+      */
+    }
+
+  }
+
   /**
    * parses the given pAE matrix and adds it to sequence 0 in the given
    * alignment
   /**
    * parses the given pAE matrix and adds it to sequence 0 in the given
    * alignment
@@ -336,7 +353,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
       Console.debug("***** Got sequence at index " + seqToGet + ": "
               + (sequence == null ? null : sequence.getName()));
     }
       Console.debug("***** Got sequence at index " + seqToGet + ": "
               + (sequence == null ? null : sequence.getName()));
     }
-    else
+    if (sequence == null)
     {
       Console.debug("***** Looking for sequence with id '" + seqId + "'");
 
     {
       Console.debug("***** Looking for sequence with id '" + seqId + "'");