import static jalview.math.RotatableMatrix.Axis.Y;
import static jalview.math.RotatableMatrix.Axis.Z;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.Conservation;
import jalview.analysis.PCA;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.gui.ChimeraViewFrame;
import jalview.gui.Desktop;
import jalview.gui.FeatureRenderer;
-import jalview.gui.Jalview2XML_V1;
import jalview.gui.JvOptionPane;
import jalview.gui.OOMWarning;
import jalview.gui.PCAPanel;
import jalview.gui.StructureViewer.ViewerType;
import jalview.gui.StructureViewerBase;
import jalview.gui.TreePanel;
+import jalview.io.BackupFiles;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.io.NewickFile;
public void saveState(File statefile)
{
FileOutputStream fos = null;
+
try
{
+
fos = new FileOutputStream(statefile);
+
JarOutputStream jout = new JarOutputStream(fos);
saveState(jout);
+ fos.close();
} catch (Exception e)
{
+ Cache.log.error("Couln't write Jalview state to " + statefile, e);
// TODO: inform user of the problem - they need to know if their data was
// not saved !
if (errorMessage == null)
{
- errorMessage = "Couldn't write Jalview Archive to output file '"
+ errorMessage = "Did't write Jalview Archive to output file '"
+ statefile + "' - See console error log for details";
}
else
{
- errorMessage += "(output file was '" + statefile + "')";
+ errorMessage += "(Didn't write Jalview Archive to output file '"
+ + statefile + ")";
}
e.printStackTrace();
} finally
{
try
{
- FileOutputStream fos = new FileOutputStream(jarFile);
+ // create backupfiles object and get new temp filename destination
+ BackupFiles backupfiles = new BackupFiles(jarFile);
+ FileOutputStream fos = new FileOutputStream(
+ backupfiles.getTempFilePath());
+
JarOutputStream jout = new JarOutputStream(fos);
List<AlignFrame> frames = new ArrayList<>();
}
;
jout.close();
- return true;
+ boolean success = true;
+
+ backupfiles.setWriteSuccess(success);
+ success = backupfiles.rollBackupsAndRenameTempFile();
+
+ return success;
} catch (Exception ex)
{
errorMessage = "Couldn't Write alignment view to Jalview Archive - see error output for details";
view.setRenderGaps(av.isRenderGaps());
view.setShowAnnotation(av.isShowAnnotation());
view.setShowBoxes(av.getShowBoxes());
+ view.setShowAutocalcAbove(av.isShowAutocalculatedAbove());
+ view.setSortAnnotationsBy(av.getSortAnnotationsBy().name());
view.setShowColourText(av.getColourText());
view.setShowFullId(av.getShowJVSuffix());
view.setRightAlignIds(av.isRightAlignIds());
ex.printStackTrace(System.err);
if (attemptversion1parse)
{
- // Is Version 1 Jar file?
- try
- {
- af = new Jalview2XML_V1(raiseGUI).LoadJalviewAlign(jprovider);
- } catch (Exception ex2)
- {
- System.err.println("Exception whilst loading as jalviewXMLV1:");
- ex2.printStackTrace();
- af = null;
- }
+ // used to attempt to parse as V1 castor-generated xml
}
if (Desktop.instance != null)
{
}
else
{
- cs = ColourSchemeProperty.getColourScheme(al,
+ cs = ColourSchemeProperty.getColourScheme(null, al,
jGroup.getColour());
}
}
// TODO: verify 'associate with all views' works still
tp.getTreeCanvas().setViewport(av); // af.viewport;
tp.getTreeCanvas().setAssociatedPanel(ap); // af.alignPanel;
- // FIXME: should we use safeBoolean here ?
- tp.getTreeCanvas().setApplyToAllViews(tree.isLinkToAllViews());
-
}
+ tp.getTreeCanvas().setApplyToAllViews(tree.isLinkToAllViews());
if (tp == null)
{
warn("There was a problem recovering stored Newick tree: \n"
viewport.setColourText(safeBoolean(view.isShowColourText()));
- viewport
- .setConservationSelected(
- safeBoolean(view.isConservationSelected()));
+ viewport.setConservationSelected(
+ safeBoolean(view.isConservationSelected()));
viewport.setIncrement(safeInt(view.getConsThreshold()));
viewport.setShowJVSuffix(safeBoolean(view.isShowFullId()));
viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds()));
viewport.setWrapAlignment(safeBoolean(view.isWrapAlignment()));
viewport.setShowAnnotation(safeBoolean(view.isShowAnnotation()));
- viewport.setShowBoxes(safeBoolean(view.isShowBoxes()));
+ Boolean autocalcFirst = view.isShowAutocalcAbove();
+ if (autocalcFirst != null)
+ {
+ af.setShowAutoCalculatedAbove(autocalcFirst.booleanValue());
+ }
+ String sortBy = view.getSortAnnotationsBy();
+ if (sortBy != null)
+ {
+ try
+ {
+ viewport.setSortAnnotationsBy(
+ SequenceAnnotationOrder.valueOf(sortBy));
+ } catch (IllegalArgumentException e)
+ {
+ Cache.log.error(
+ "Invalid annotation sort specifier in project: " + sortBy);
+ }
+ }
+ viewport.setShowBoxes(safeBoolean(view.isShowBoxes()));
viewport.setShowText(safeBoolean(view.isShowText()));
-
viewport.setTextColour(new Color(safeInt(view.getTextCol1())));
viewport.setTextColour2(new Color(safeInt(view.getTextCol2())));
viewport.setThresholdTextColour(safeInt(view.getTextColThreshold()));
}
else
{
- cs = ColourSchemeProperty.getColourScheme(al, view.getBgColour());
+ cs = ColourSchemeProperty.getColourScheme(af.getViewport(), al,
+ view.getBgColour());
}
}
+ /*
+ * turn off 'alignment colour applies to all groups'
+ * while restoring global colour scheme
+ */
+ viewport.setColourAppliesToAllGroups(false);
viewport.setGlobalColourScheme(cs);
viewport.getResidueShading().setThreshold(pidThreshold,
view.isIgnoreGapsinConsensus());
viewport.getResidueShading()
.setConsensus(viewport.getSequenceConsensusHash());
- viewport.setColourAppliesToAllGroups(false);
-
if (safeBoolean(view.isConservationSelected()) && cs != null)
{
viewport.getResidueShading()
.setConservationInc(safeInt(view.getConsThreshold()));
}
-
af.changeColour(cs);
-
viewport.setColourAppliesToAllGroups(true);
viewport
float min = safeFloat(safeFloat(setting.getMin()));
float max = setting.getMax() == null ? 1f
: setting.getMax().floatValue();
- FeatureColourI gc = new FeatureColour(minColour, maxColour,
+ FeatureColourI gc = new FeatureColour(maxColour, minColour,
+ maxColour,
noValueColour, min, max);
if (setting.getAttributeName().size() > 0)
{
// recompute any autoannotation
af.alignPanel.updateAnnotation(false, true);
reorderAutoannotation(af, al, autoAlan);
+ af.sortAnnotations();
af.alignPanel.alignmentChanged();
}
else
else
{
cs = new AnnotationColourGradient(matchedAnnotation,
- ColourSchemeProperty.getColourScheme(al,
+ ColourSchemeProperty.getColourScheme(af.getViewport(), al,
viewAnnColour.getColourScheme()),
safeInt(viewAnnColour.getAboveThreshold()));
}
noValueColour = maxcol;
}
- colour = new FeatureColour(mincol, maxcol, noValueColour,
+ colour = new FeatureColour(maxcol, mincol, maxcol, noValueColour,
safeFloat(colourModel.getMin()),
safeFloat(colourModel.getMax()));
final List<String> attributeName = colourModel.getAttributeName();