package jalview.bin;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
import java.util.Map;
import jalview.analysis.AlignmentUtils;
import jalview.bin.ArgParser.Arg;
import jalview.bin.ArgParser.ArgValues;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.io.AppletFormatAdapter;
import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.ws.dbsources.EBIAlfaFold;
public class Commands
{
protected void processLinked(String id)
{
Map<Arg, ArgValues> m = argParser.linkedArgs(id);
- FileLoader fileLoader = new FileLoader(!headless);
/*
// script to execute after all loading is completed one way or another
{
if (openFile == null)
continue OPEN;
- Console.debug("********** id = " + id + ", openFile = " + openFile);
if (first)
{
af = afMap.get(id);
if (af == null)
{
+ // get kind of temperature factor annotation
+ AlignmentAnnotation.TFType tempfacType = null;
+ if ((m.get(Arg.NOTEMPFAC) == null
+ || !m.get(Arg.NOTEMPFAC).getBoolean())
+ && m.get(Arg.TEMPFAC) != null)
+ {
+ try
+ {
+ tempfacType = AlignmentAnnotation.TFType
+ .valueOf(m.get(Arg.TEMPFAC).getValue()
+ .toUpperCase(Locale.ROOT));
+ Console.debug("Obtained Temperature Factor type of '"
+ + tempfacType + "'");
+ } catch (IllegalArgumentException e)
+ {
+ StringBuilder sb = new StringBuilder().append("Cannot set --")
+ .append(Arg.TEMPFAC.getName()).append(" to '")
+ .append(tempfacType)
+ .append("', ignoring. Valid values are: ");
+ Iterator<AlignmentAnnotation.TFType> it = Arrays
+ .stream(AlignmentAnnotation.TFType.values())
+ .iterator();
+ while (it.hasNext())
+ {
+ sb.append(it.next().toString().toLowerCase(Locale.ROOT));
+ if (it.hasNext())
+ sb.append(", ");
+ }
+ Console.warn(sb.toString());
+ }
+ }
+
Console.debug(
"Opening '" + openFile + "' in new alignment frame");
- af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
- format);
+ FileLoader fileLoader = new FileLoader(!headless);
+ af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format,
+ tempfacType);
+
+ // wrap alignment?
+ if (m.get(Arg.WRAP) != null && m.get(Arg.WRAP).getBoolean())
+ {
+ af.getCurrentView().setWrapAlignment(true);
+ }
+
+ // change alignment frame title
if (m.get(Arg.TITLE) != null)
af.setTitle(m.get(Arg.TITLE).getValue());
+
+ // show secondary structure annotations?
if (m.get(Arg.SSANNOTATION) != null
&& !m.get(Arg.SSANNOTATION).getBoolean())
{
Collections.singleton("Secondary Structure"), null,
false, false);
}
+
+ // show temperature factor annotations?
if (m.get(Arg.NOTEMPFAC) != null
&& m.get(Arg.NOTEMPFAC).getBoolean())
{
// do this better (annotation types?)
+ List<String> hideThese = new ArrayList<>();
+ hideThese.add("Temperature Factor");
+ hideThese.add(MessageManager
+ .getString("label.alphafold_reliability"));
AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(),
- Collections.singleton("Temperature Factor"), null,
- false, false);
- AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(),
- Collections.singleton("Alphafold Reliability"), null,
+ af.getCurrentView().getAlignment(), hideThese, null,
false, false);
}
+ else
+ {
+ if (m.get(Arg.TEMPFAC_LABEL) != null)
+ {
+ AlignmentAnnotation aa = AlignmentUtils
+ .getFirstSequenceAnnotationOfType(
+ af.getCurrentView().getAlignment(),
+ AlignmentAnnotation.LINE_GRAPH);
+ Console.debug("***** Trying to change label from '"
+ + (aa == null ? aa : aa.label) + "' to '"
+ + m.get(Arg.TEMPFAC_LABEL).getValue() + "'");
+ if (aa != null)
+ {
+ aa.label = m.get(Arg.TEMPFAC_LABEL).getValue();
+ }
+ }
+ }
+
+ //
+
+ // load a pAE file?
+ if (m.get(Arg.PAEMATRIX) != null)
+ {
+ File paeFile = new File(m.get(Arg.PAEMATRIX).getValue());
+ EBIAlfaFold.addAlphaFoldPAE(af.getCurrentView().getAlignment(),
+ paeFile);
+ }
// store the AlignFrame for this id
afMap.put(id, af);