+ if (headless)
+ {
+ Cache.setProperty(Preferences.STRUCTURE_DISPLAY,
+ StructureViewer.ViewerType.JMOL.toString());
+ }
+
+ String structureFilepath = structureFile.getAbsolutePath();
+
+ // get PAEMATRIX file and label from subvals or Arg.PAEMATRIX
+ String paeFilepath = subVals.getWithSubstitutions(argParser, id,
+ "paematrix");
+ String paeLabel = subVals.get("paelabel");
+ ArgValue paeAv = getArgAssociatedWithStructure(Arg.PAEMATRIX, avm,
+ af, structureFilepath);
+ if (paeFilepath == null && paeAv != null)
+ {
+ SubVals sv = paeAv.getSubVals();
+ File paeFile = new File(sv.getContent());
+
+ paeLabel = sv.get("label");
+ try
+ {
+ paeFilepath = paeFile.getCanonicalPath();
+ } catch (IOException e)
+ {
+ paeFilepath = paeFile.getAbsolutePath();
+ Console.warn("Problem with the PAE file path: '"
+ + paeFile.getPath() + "'");
+ }
+ }
+
+ // showing annotations from structure file or not
+ boolean ssFromStructure = ArgParser.getFromSubValArgOrPref(avm,
+ Arg.SSANNOTATIONS, subVals, null, "STRUCT_FROM_PDB",
+ true);
+
+ // get TEMPFAC type from subvals or Arg.TEMPFAC in case user Adds
+ // reference annotations
+ String tftString = subVals.get("tempfac");
+ TFType tft = avm.getBoolean(Arg.NOTEMPFAC) ? null
+ : TFType.DEFAULT;
+ ArgValue tftAv = getArgAssociatedWithStructure(Arg.TEMPFAC, avm,
+ af, structureFilepath);
+ if (tftString == null && tftAv != null)
+ {
+ tftString = tftAv.getSubVals().getContent();
+ }
+ if (tftString != null)
+ {
+ // get kind of temperature factor annotation
+ try
+ {
+ tft = TFType.valueOf(tftString.toUpperCase(Locale.ROOT));
+ Console.debug("Obtained Temperature Factor type of '" + tft
+ + "' for structure '" + structureFilepath + "'");
+ } catch (IllegalArgumentException e)
+ {
+ // Just an error message!
+ StringBuilder sb = new StringBuilder().append("Cannot set ")
+ .append(Arg.TEMPFAC.argString()).append(" to '")
+ .append(tft)
+ .append("', ignoring. Valid values are: ");
+ Iterator<TFType> it = Arrays.stream(TFType.values())
+ .iterator();
+ while (it.hasNext())
+ {
+ sb.append(it.next().toString().toLowerCase(Locale.ROOT));
+ if (it.hasNext())
+ sb.append(", ");
+ }
+ Console.warn(sb.toString());
+ }
+ }
+
+ String sViewer = ArgParser.getFromSubValArgOrPref(avm,
+ Arg.STRUCTUREVIEWER, Position.AFTER, av, subVals,
+ "viewer", null, "jmol");
+ ViewerType viewerType = null;
+ if (!"none".equals(sViewer))
+ {
+ for (ViewerType v : EnumSet.allOf(ViewerType.class))
+ {
+ String name = v.name().toLowerCase(Locale.ROOT)
+ .replaceAll(" ", "");
+ if (sViewer.equals(name))
+ {
+ viewerType = v;
+ break;
+ }
+ }
+ }
+
+ boolean addTempFac = tft != null
+ || Cache.getDefault("ADD_TEMPFACT_ANN", false);
+
+ // TODO use ssFromStructure
+ StructureChooser.openStructureFileForSequence(null, null, ap, seq,
+ false, structureFilepath, tft, paeFilepath, false,
+ ssFromStructure, false, viewerType);