import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
if (avm == null)
return true;
- /*
- * // script to execute after all loading is completed one way or another String
- * groovyscript = m.get(Arg.GROOVY) == null ? null :
- * m.get(Arg.GROOVY).getValue(); String file = m.get(Arg.OPEN) == null ? null :
- * m.get(Arg.OPEN).getValue(); String data = null; FileFormatI format = null;
- * DataSourceType protocol = null;
- */
+ // set wrap scope here so it can be applied after structures are opened
+ boolean wrap = false;
+
if (avm.containsArg(Arg.APPEND) || avm.containsArg(Arg.OPEN))
{
commandArgsProvided = true;
if (!(new File(openFile)).exists())
{
Console.warn("Can't find file '" + openFile + "'");
+ continue;
}
}
}
} catch (FileFormatException e1)
{
Console.error("Unknown file format for '" + openFile + "'");
+ continue;
}
af = afMap.get(id);
Console.debug(
"Opening '" + openFile + "' in new alignment frame");
FileLoader fileLoader = new FileLoader(!headless);
-
- af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
- format);
-
- // wrap alignment?
- boolean wrap = ArgParser.getFromSubValArgOrPref(avm, Arg.WRAP, sv,
- null, "WRAP_ALIGNMENT", false);
- af.getCurrentView().setWrapAlignment(wrap);
+ boolean xception=false;
+ try {
+ af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
+ format);
+ } catch (Throwable thr)
+ {
+ xception=true;
+ Console.error("Couldn't open '"+openFile+"' as "+format+" "+thr.getLocalizedMessage()+ " (Enable debug for full stack trace)");
+ Console.debug("Exception when opening '"+openFile+"'",thr);
+ }
+ finally
+ {
+ if (af==null && !xception)
+ {
+ Console.info("Ignoring '"+openFile+"' - no alignment data found.");
+ continue;
+ }
+ }
// colour alignment?
String colour = ArgParser.getFromSubValArgOrPref(avm, av,
false, false);
}
+ // wrap alignment? do this last for formatting reasons
+ wrap = ArgParser.getFromSubValArgOrPref(avm, Arg.WRAP, sv, null,
+ "WRAP_ALIGNMENT", false);
+ // af.setWrapFormat(wrap) is applied after structures are opened for
+ // annotation reasons
+
// store the AlignFrame for this id
afMap.put(id, af);
String sViewer = ArgParser.getFromSubValArgOrPref(avm,
Arg.STRUCTUREVIEWER, Position.AFTER, av, subVals, null,
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;
- }
- }
- }
+ ViewerType viewerType = ViewerType.getFromString(sViewer);
// TODO use ssFromStructure
StructureViewer sv = StructureChooser
}
}
+ if (wrap)
+ {
+ AlignFrame af = afMap.get(id);
+ if (af != null)
+ {
+ af.setWrapFormat(wrap, true);
+ }
+ }
+
/*
boolean doShading = avm.getBoolean(Arg.TEMPFAC_SHADING);
if (doShading)
case "biojs":
Console.debug(
- "Creating BioJS MSA Viwer HTML file: " + fileName);
+ "Outputting BioJS MSA Viwer HTML file: " + fileName);
try
{
BioJsHTMLOutput.refreshVersionInfo(
break;
case "eps":
- Console.debug("Creating EPS file: " + fileName);
- af.createEPS(file, name);
+ Console.debug("Outputting EPS file: " + fileName);
+ af.createEPS(file, renderer);
break;
case "imagemap":
- Console.debug("Creating ImageMap file: " + fileName);
+ Console.debug("Outputting ImageMap file: " + fileName);
af.createImageMap(file, name);
break;
seq = al.getSequenceAt(subVals.getIndex());
}
}
- else if (idAv != null)
+ if (seq == null && idAv != null)
{
seq = al.findName(idAv.getValue());
}