+ return seq;
+ }
+
+ public AlignFrame[] getAlignFrames()
+ {
+ AlignFrame[] afs = null;
+ if (afMap != null)
+ {
+ afs = (AlignFrame[]) afMap.values().toArray();
+ }
+
+ return afs;
+ }
+
+ public List<StructureViewer> getStructureViewers()
+ {
+ List<StructureViewer> svs = null;
+ if (svMap != null)
+ {
+ for (List<StructureViewer> svList : svMap.values())
+ {
+ if (svs == null)
+ {
+ svs = new ArrayList<>();
+ }
+ svs.addAll(svList);
+ }
+ }
+ return svs;
+ }
+
+ private void addInfo(String errorMessage)
+ {
+ Console.info(errorMessage);
+ errors.add(errorMessage);
+ }
+
+ private void addWarn(String errorMessage)
+ {
+ Console.warn(errorMessage);
+ errors.add(errorMessage);
+ }
+
+ private void addError(String errorMessage)
+ {
+ addError(errorMessage, null);
+ }
+
+ private void addError(String errorMessage, Exception e)
+ {
+ Console.error(errorMessage, e);
+ errors.add(errorMessage);
+ }
+
+ private boolean checksBeforeWritingToFile(ArgValuesMap avm,
+ SubVals subVal, boolean includeBackups, String filename,
+ String adjective, Boolean isError)
+ {
+ File file = new File(filename);
+
+ boolean overwrite = ArgParser.getFromSubValArgOrPref(avm, Arg.OVERWRITE,
+ subVal, null, "OVERWRITE_OUTPUT", false);
+ boolean stdout = false;
+ boolean backups = false;
+ if (includeBackups)
+ {
+ stdout = ArgParser.STDOUTFILENAME.equals(filename);
+ // backups. Use the Arg.BACKUPS or subval "backups" setting first,
+ // otherwise if headless assume false, if not headless use the user
+ // preference with default true.
+ backups = ArgParser.getFromSubValArgOrPref(avm, Arg.BACKUPS, subVal,
+ null, Platform.isHeadless() ? null : BackupFiles.ENABLED,
+ !Platform.isHeadless());
+ }
+
+ if (file.exists() && !(overwrite || backups || stdout))
+ {
+ addWarn("Won't overwrite file '" + filename + "' without "
+ + Arg.OVERWRITE.argString()
+ + (includeBackups ? " or " + Arg.BACKUPS.argString() : "")
+ + " set");
+ return false;
+ }
+
+ boolean mkdirs = ArgParser.getFromSubValArgOrPref(avm, Arg.MKDIRS,
+ subVal, null, "MKDIRS_OUTPUT", false);
+
+ if (!FileUtils.checkParentDir(file, mkdirs))
+ {
+ addError("Directory '"
+ + FileUtils.getParentDir(file).getAbsolutePath()
+ + "' does not exist for " + adjective + " file '" + filename
+ + "'."
+ + (mkdirs ? "" : " Try using " + Arg.MKDIRS.argString()));
+ isError = true;
+ return false;
+ }
+
+ return true;
+ }
+
+ public List<String> getErrors()
+ {
+ return errors;
+ }
+
+ public String errorsToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String error : errors)