*/\r
package jalview.gui;\r
\r
-import jalview.binding.*;\r
-\r
import jalview.io.*;\r
\r
import jalview.schemes.*;\r
import java.net.*;\r
\r
import java.util.*;\r
+\r
import java.util.jar.*;\r
\r
import javax.swing.*;\r
\r
+import jalview.binding.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
AlignViewport av = af.viewport;\r
\r
JalviewModel object = new JalviewModel();\r
- object.setVamsasModel(new VamsasModel());\r
+ object.setVamsasModel(new jalview.binding.VamsasModel());\r
\r
object.setCreationDate(new java.util.Date(timeStamp));\r
object.setVersion(jalview.bin.Cache.getProperty("VERSION"));\r
vamsasSeq.setId(id + "");\r
vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
+ vamsasSeq.setDescription(jal.getSequenceAt(i).getDescription());\r
\r
jseq = new JSeq();\r
jseq.setStart(jal.getSequenceAt(i).getStart());\r
\r
jseq.setId(id);\r
\r
+ if(jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures()!=null)\r
+ {\r
+ Enumeration en = jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures().elements();\r
+ while(en.hasMoreElements())\r
+ {\r
+ Features features = new Features();\r
+ jalview.datamodel.SequenceFeature sf\r
+ = (jalview.datamodel.SequenceFeature)en.nextElement();\r
+\r
+ features.setBegin(sf.getBegin());\r
+ features.setEnd(sf.getEnd());\r
+ features.setDescription(sf.getDescription());\r
+ features.setStatus(sf.getStatus());\r
+ features.setType(sf.getType());\r
+ features.setFeatureGroup(sf.getFeatureGroup());\r
+ jseq.addFeatures(features);\r
+ }\r
+ }\r
+\r
+ if(jal.getSequenceAt(i).getDatasetSequence().getPDBId()!=null)\r
+ {\r
+ Enumeration en = jal.getSequenceAt(i).getDatasetSequence().getPDBId().elements();\r
+ while(en.hasMoreElements())\r
+ {\r
+ Pdbids pdb = new Pdbids();\r
+ jalview.datamodel.PDBEntry entry\r
+ = (jalview.datamodel.PDBEntry)en.nextElement();\r
+\r
+ pdb.setId(entry.getId());\r
+ pdb.setType(entry.getType());\r
+\r
+ if(entry.getProperty()!=null)\r
+ {\r
+ PdbentryItem item = new PdbentryItem();\r
+ Hashtable properties = entry.getProperty();\r
+ Enumeration en2 = properties.keys();\r
+ while(en2.hasMoreElements())\r
+ {\r
+ Property prop = new Property();\r
+ String key = en2.nextElement().toString();\r
+ prop.setName(key);\r
+ prop.setValue( properties.get(key).toString() );\r
+ item.addProperty(prop);\r
+ }\r
+ pdb.addPdbentryItem(item);\r
+ }\r
+\r
+ jseq.addPdbids(pdb);\r
+ }\r
+ }\r
+\r
jms.addJSeq(jseq);\r
vamsasSet.addSequence(vamsasSeq);\r
id++;\r
tree.setThreshold(tp.treeCanvas.threshold);\r
\r
tree.setFitToWindow(tp.fitToWindow.getState());\r
- tree.setFontSize(tp.treeCanvas.fontSize);\r
+ tree.setFontName(tp.getTreeFont().getName());\r
+ tree.setFontSize(tp.getTreeFont().getSize());\r
+ tree.setFontStyle(tp.getTreeFont().getStyle());\r
tree.setMarkUnlinked(tp.placeholdersMenu.getState());\r
+\r
tree.setShowBootstrap(tp.bootstrapMenu.getState());\r
tree.setShowDistances(tp.distanceMenu.getState());\r
\r
\r
Annotation an = new Annotation();\r
an.setDescription(aa[i].description);\r
- an.setGraph(aa[i].isGraph);\r
+ if(aa[i].graph>0)\r
+ {\r
+ an.setGraph(true);\r
+ an.setGraphType(aa[i].graph);\r
+ }\r
an.setLabel(aa[i].label);\r
\r
AnnotationElement ae;\r
groups[i].setStart(sg.getStartRes());\r
groups[i].setEnd(sg.getEndRes());\r
groups[i].setName(sg.getName());\r
-\r
- if (sg.cs instanceof ConservationColourScheme)\r
+ if(sg.cs!=null)\r
{\r
- ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
- groups[i].setConsThreshold(ccs.inc);\r
+ if (sg.cs.conservationApplied())\r
+ {\r
+ groups[i].setConsThreshold(sg.cs.getConservationInc());\r
\r
- if (ccs.cs instanceof jalview.schemes.UserColourScheme)\r
+ if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
+ {\r
+ groups[i].setColour(SetUserColourScheme(sg.cs,\r
+ userColours,\r
+ jms));\r
+ }\r
+ else\r
+ {\r
+ groups[i].setColour(ColourSchemeProperty.getColourName(sg.\r
+ cs));\r
+ }\r
+ }\r
+ else if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
{\r
- groups[i].setColour(SetUserColourScheme(ccs.cs, userColours,\r
- jms));\r
+ groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
+ jms));\r
}\r
else\r
{\r
- groups[i].setColour(ColourSchemeProperty.getColourName(sg.cs));\r
+ groups[i].setColour(ColourSchemeProperty.getColourName(\r
+ sg.cs));\r
}\r
- }\r
-\r
- else if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
- {\r
- groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
- jms));\r
- }\r
- else\r
- {\r
- groups[i].setColour(ColourSchemeProperty.getColourName(\r
- sg.cs));\r
- }\r
\r
- if (sg.cs instanceof ResidueColourScheme)\r
- {\r
- groups[i].setPidThreshold(((ResidueColourScheme) sg.cs).getThreshold());\r
+ groups[i].setPidThreshold(sg.cs.getThreshold());\r
}\r
\r
-\r
-\r
groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
groups[i].setDisplayText(sg.getDisplayText());\r
jms.setJGroup(groups);\r
}\r
\r
+\r
///////////SAVE VIEWPORT\r
Viewport view = new Viewport();\r
view.setTitle(af.getTitle());\r
\r
ColourSchemeI cs = av.getGlobalColourScheme();\r
\r
- if (cs instanceof ConservationColourScheme)\r
+ if(cs!=null)\r
{\r
- ConservationColourScheme ccs = (ConservationColourScheme)cs;\r
- view.setConsThreshold(ccs.inc);\r
- if(ccs.cs instanceof jalview.schemes.UserColourScheme)\r
- view.setBgColour(SetUserColourScheme(ccs.cs, userColours, jms));\r
- }\r
+ if (cs.conservationApplied())\r
+ {\r
+ view.setConsThreshold(cs.getConservationInc());\r
+ if (cs instanceof jalview.schemes.UserColourScheme)\r
+ view.setBgColour(SetUserColourScheme(cs, userColours, jms));\r
+ }\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- view.setPidThreshold(((ResidueColourScheme) cs).getThreshold());\r
+ if (cs instanceof ResidueColourScheme)\r
+ {\r
+ view.setPidThreshold(cs.getThreshold());\r
+ }\r
}\r
\r
view.setConservationSelected(av.getConservationSelected());\r
view.setShowBoxes(av.getShowBoxes());\r
view.setShowColourText(av.getColourText());\r
view.setShowConservation(av.showConservation);\r
- view.setShowFullId(av.getShowFullId());\r
+ view.setShowFullId(av.getShowJVSuffix());\r
view.setShowIdentity(av.showIdentity);\r
view.setShowQuality(av.showQuality);\r
view.setShowSequenceFeatures(av.showSequenceFeatures);\r
view.setShowText(av.getShowText());\r
view.setWrapAlignment(av.getWrapAlignment());\r
\r
+ if(af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed!=null)\r
+ {\r
+ jalview.binding.FeatureSettings fs = new jalview.binding.FeatureSettings();\r
+\r
+ Enumeration e = af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours.keys();\r
+ while (e.hasMoreElements())\r
+ {\r
+ String type = e.nextElement().toString();\r
+ Setting setting = new Setting();\r
+ setting.setType(type);\r
+ setting.setColour(\r
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().getColour(type).getRGB()\r
+ );\r
+ setting.setDisplay(\r
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed.contains(type)\r
+ );\r
+\r
+ fs.addSetting(setting);\r
+\r
+ }\r
+ jms.setFeatureSettings(fs);\r
+\r
+ }\r
+\r
jms.addViewport(view);\r
\r
+\r
object.setJalviewModelSequence(jms);\r
object.getVamsasModel().addSequenceSet(vamsasSet);\r
\r
}\r
while (jarentry != null);\r
}\r
+ catch(java.net.UnknownHostException ex)\r
+ {\r
+ ex.printStackTrace();\r
+ System.err.println("Couldn't locate Jalview XML file : " +\r
+ ex + "\n");\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Couldn't locate " + file,\r
+ "URL not found",\r
+ JOptionPane.WARNING_MESSAGE);\r
+\r
+ }\r
catch (Exception ex)\r
{\r
ex.printStackTrace();\r
System.err.println("Exception whilst loading jalview XML file : " +\r
ex + "\n");\r
JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
- "Couldn't locate " + file,\r
- "URL not found",\r
+ "Error loading " + file,\r
+ "Error loading Jalview file",\r
JOptionPane.WARNING_MESSAGE);\r
\r
}\r
//LOAD SEQUENCES\r
jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
-\r
for (int i = 0; i < vamsasSeq.length; i++)\r
{\r
jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
vamsasSeq[i].getSequence());\r
+ jseqs[i].setDescription( vamsasSeq[i].getDescription() );\r
\r
jseqs[i].setStart(JSEQ[i].getStart());\r
jseqs[i].setEnd(JSEQ[i].getEnd());\r
seqids.add(jseqs[i]);\r
}\r
\r
+ ///SequenceFeatures are added to the DatasetSequence,\r
+ // so we must create the dataset before loading features\r
/////////////////////////////////\r
jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
+ al.setDataset(null);\r
+ /////////////////////////////////\r
\r
+ for (int i = 0; i < vamsasSeq.length; i++)\r
+ {\r
+ if (JSEQ[i].getFeaturesCount() > 0)\r
+ {\r
+ Features[] features = JSEQ[i].getFeatures();\r
+ for (int f = 0; f < features.length; f++)\r
+ {\r
+ //features[f].getBegin()\r
+ jalview.datamodel.SequenceFeature sf\r
+ = new jalview.datamodel.SequenceFeature(features[f].getType(),\r
+ features[f].getDescription(), features[f].getStatus(),\r
+ features[f].getBegin(), features[f].getEnd());\r
+ sf.setFeatureGroup(features[f].getFeatureGroup());\r
+ al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);\r
+ }\r
+ }\r
+ if (JSEQ[i].getPdbidsCount() > 0)\r
+ {\r
+ Pdbids[] ids = JSEQ[i].getPdbids();\r
+ for (int p = 0; p < ids.length; p++)\r
+ {\r
+ jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();\r
+ entry.setId(ids[p].getId());\r
+ entry.setType(ids[p].getType());\r
+ al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);\r
+ }\r
+\r
+ }\r
+ }\r
/////////////////////////////////\r
//////////////////////////////////\r
//LOAD ANNOTATIONS\r
if (an[i].getGraph())\r
{\r
jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
- an[i].getDescription(), anot, 0, 0, 1);\r
+ an[i].getDescription(), anot, 0, 0,\r
+ an[i].getGraphType());\r
}\r
else\r
{\r
\r
AlignFrame af = new AlignFrame(al);\r
\r
+\r
// af.changeColour() );\r
/////////////////////////\r
//LOAD GROUPS\r
groups[i].getColour());\r
}\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ((ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold(), true);\r
- }\r
+ cs.setThreshold(groups[i].getPidThreshold(), true);\r
}\r
\r
Vector seqs = new Vector();\r
sg.getWidth() - 1);\r
c.calculate();\r
c.verdict(false, 25);\r
- cs = new ConservationColourScheme(c, cs);\r
- sg.cs = cs;\r
+ sg.cs.setConservation(c);\r
}\r
\r
al.addGroup(sg);\r
}\r
}\r
\r
- Desktop.addInternalFrame(af, view.getTitle(),\r
- AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+\r
af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
view.getHeight());\r
af.viewport.setStartRes(view.getStartRes());\r
af.viewport.setStartSeq(view.getStartSeq());\r
+ af.viewport.setShowAnnotation(view.getShowAnnotation());\r
af.viewport.showConservation = view.getShowConservation();\r
af.viewport.showQuality = view.getShowQuality();\r
af.viewport.showIdentity = view.getShowIdentity();\r
af.viewport.setConservationSelected(view.getConservationSelected());\r
af.conservationMenuItem.setSelected(view.getConservationSelected());\r
\r
- af.viewport.setShowFullId(view.getShowFullId());\r
- af.fullSeqId.setSelected(view.getShowFullId());\r
+ af.viewport.setShowJVSuffix(view.getShowFullId());\r
+ af.seqLimits.setSelected(view.getShowFullId());\r
\r
af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
view.getFontStyle(), view.getFontSize()));\r
cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
}\r
\r
- if (cs instanceof ResidueColourScheme)\r
- {\r
- ((ResidueColourScheme) cs).setThreshold(view.getPidThreshold(), true);\r
- }\r
-\r
if(cs!=null)\r
+ {\r
+ cs.setThreshold(view.getPidThreshold(), true);\r
cs.setConsensus(af.viewport.vconsensus);\r
+ }\r
}\r
\r
af.setColourSelected(view.getBgColour());\r
af.viewport.setGlobalColourScheme(cs);\r
af.viewport.setColourAppliesToAllGroups(false);\r
- af.changeColour(af.viewport.getGlobalColourScheme());\r
- if (view.getConservationSelected())\r
+ af.changeColour(cs);\r
+ if (view.getConservationSelected() && cs!=null)\r
{\r
- ( (ConservationColourScheme) af.viewport.getGlobalColourScheme()).inc = view.getConsThreshold();\r
+ cs.setConservationInc(view.getConsThreshold());\r
}\r
\r
af.viewport.setColourAppliesToAllGroups(true);\r
\r
if (view.getShowSequenceFeatures())\r
{\r
- af.viewport.showSequenceFeatures = true;\r
- af.sequenceFeatures.setSelected(true);\r
- new SequenceFeatureFetcher(al, af.alignPanel);\r
- al.featuresAdded = true;\r
+ af.viewport.showSequenceFeatures = true;\r
+ af.showSeqFeatures.setSelected(true);\r
}\r
\r
+ if(jms.getFeatureSettings()!=null)\r
+ {\r
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed = new Vector();\r
+ // af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed!=null)\r
+ // jalview.binding.FeatureSettings fs = new jalview.binding.FeatureSettings();\r
+ for(int fs=0; fs<jms.getFeatureSettings().getSettingCount(); fs++)\r
+ {\r
+ Setting setting = jms.getFeatureSettings().getSetting(fs);\r
+\r
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(setting.getType(),\r
+ new java.awt.Color(setting.getColour()));\r
+ if(setting.getDisplay())\r
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed.addElement(setting.getType());\r
+ }\r
+ }\r
+\r
+ Desktop.addInternalFrame(af, view.getTitle(),\r
+ view.getWidth(), view.getHeight());\r
+\r
//LOAD TREES\r
///////////////////////////////////////\r
if (jms.getTreeCount() > 0)\r
{\r
for (int t = 0; t < jms.getTreeCount(); t++)\r
{\r
+\r
Tree tree = jms.getTree(t);\r
\r
TreePanel tp = af.ShowNewickTree(new jalview.io.NewickFile(\r
- tree.getNewick()), tree.getTitle());\r
-\r
- tp.setBounds(tree.getXpos(), tree.getYpos(),\r
- tree.getWidth(), tree.getHeight());\r
+ tree.getNewick()), tree.getTitle(),\r
+ tree.getWidth(), tree.getHeight(),\r
+ tree.getXpos(), tree.getYpos());\r
\r
tp.fitToWindow.setState(tree.getFitToWindow());\r
tp.fitToWindow_actionPerformed(null);\r
- tp.treeCanvas.fontSize = tree.getFontSize();\r
- tp.fontSize.setText("Font Size - " + tree.getFontSize());\r
- tp.placeholdersMenu.setState(tree.getMarkUnlinked());\r
- tp.placeholdersMenu_actionPerformed(null);\r
- tp.bootstrapMenu.setState(tree.getShowBootstrap());\r
- tp.bootstrapMenu_actionPerformed(null);\r
- tp.distanceMenu.setState(tree.getShowDistances());\r
- tp.distanceMenu_actionPerformed(null);\r
+\r
+ if(tree.getFontName()!=null)\r
+ tp.setTreeFont(new java.awt.Font(tree.getFontName(),\r
+ tree.getFontStyle(),\r
+ tree.getFontSize()));\r
+ else\r
+ tp.setTreeFont(new java.awt.Font(view.getFontName(),\r
+ view.getFontStyle(),\r
+ tree.getFontSize()));\r
+\r
+ tp.showPlaceholders(tree.getMarkUnlinked());\r
+ tp.showBootstrap(tree.getShowBootstrap());\r
+ tp.showDistances(tree.getShowDistances());\r
+\r
tp.treeCanvas.threshold = tree.getThreshold();\r
\r
if (tree.getCurrentTree())\r
af.viewport.setCurrentTree(tp.getTree());\r
}\r
+\r
}\r
catch (Exception ex)\r
{\r
ex.printStackTrace();\r
}\r
+\r
}\r
+\r
return af;\r
}\r
}\r